[英]Python "[WinError 233] No process is on the other end of the pipe" on print statement
I wrote a Python script that goes forever in a while true loop and runs other Python scripts by interval like this:我写了一个 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)
And the run_command_parallel method is like this:而run_command_parallel方法是这样的:
def run_command_parallel(self):
thread.start_new_thread(os.system, ("python some_other_script.py", ))
The script works fine for several days.该脚本可以正常运行几天。 However, after 3-4 days I always receive an error from some random print statement of scripts that run in separate threads: "[WinError 233] No process is on the other end of the pipe".
但是,在 3-4 天后,我总是从在单独线程中运行的脚本的一些随机打印语句中收到错误:“[WinError 233] 管道的另一端没有进程”。 The script with the while loop also gets terminated.
带有 while 循环的脚本也会终止。 Any idea on why I receive this error and why the script with the while loop gets terminated?
关于为什么我收到此错误以及为什么带有 while 循环的脚本被终止的任何想法? Or an alternative solution that can work in Python (without using batches or windows task schedulers)?
或者可以在 Python 中工作的替代解决方案(不使用批处理或 windows 任务调度程序)?
I also ran into the issue, after trying out multiple ways to fix it, what helped me was the most rudimentary solution for any kind of IT problems.我也遇到了这个问题,在尝试了多种方法来解决它之后,对我有帮助的是针对任何类型的 IT 问题的最基本的解决方案。 Simply restarting the PC was what solved my issue.
只需重新启动 PC 即可解决我的问题。 I know its kind of anticlimactic but that is what helped me and for some reason there is not enough information regarding this error in python.
我知道它有点虎头蛇尾,但这对我有帮助,由于某种原因,在 python 中没有足够的信息来说明这个错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.