簡體   English   中英

Python 打印語句上的“[WinError 233] 管道的另一端沒有進程”

[英]Python "[WinError 233] No process is on the other end of the pipe" on print statement

我寫了一個 Python 腳本,它永遠在一個真正的循環中運行,並按如下間隔運行其他 Python 腳本:

while True:
        now = time.time()
        for command in self.commands:
            if (command.last_called_timestamp + command.interval) < now:
                command.last_called_timestamp = now
                command.run_command_parallel()
        time.sleep(0.1)

而run_command_parallel方法是這樣的:

def run_command_parallel(self):    
    thread.start_new_thread(os.system, ("python some_other_script.py", ))

該腳本可以正常運行幾天。 但是,在 3-4 天后,我總是從在單獨線程中運行的腳本的一些隨機打印語句中收到錯誤:“[WinError 233] 管道的另一端沒有進程”。 帶有 while 循環的腳本也會終止。 關於為什么我收到此錯誤以及為什么帶有 while 循環的腳本被終止的任何想法? 或者可以在 Python 中工作的替代解決方案(不使用批處理或 windows 任務調度程序)?

我也遇到了這個問題,在嘗試了多種方法來解決它之后,對我有幫助的是針對任何類型的 IT 問題的最基本的解決方案。 只需重新啟動 PC 即可解決我的問題。 我知道它有點虎頭蛇尾,但這對我有幫助,由於某種原因,在 python 中沒有足夠的信息來說明這個錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM