简体   繁体   English

Python 打印语句上的“[WinError 233] 管道的另一端没有进程”

[英]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.

相关问题 为什么在Python的print语句末尾使用\\? - Why \ is used at the end of print statement in python? 打印语句中的end关键字在Python UBUNTU中不起作用 - End keyword in print statement is not working in Python UBUNTU 用中间过程分解打印语句Python - Breaking up a print statement Python with intermediate process 我的python代码在循环结束时未运行打印语句 - My python code does not run a print statement at the end of a loop 当前流程与其他流程之间的管道 - Pipe between current process and other process Python 打印语句在我的函数末尾不打印任何内容 - Python print statement not printing anything at the end of my function 如何仅在 Python 中到达循环结束后打印失败语句? - How to print a fail statement only after reaching end of loop in Python? 在python中的子过程调用期间使用stdout = subprocess.PIPE时如何获得正常的打印语句执行 - how to get the normal print statement execution when using stdout=subprocess.PIPE during subprocess call in python Python 中的打印 function 的奇怪行为:OSError [WinError 87] - Weird behavior from print function in Python: OSError [WinError 87] Python - PermissionError: [WinError 32] 文件正被另一个进程使用 - Python - PermissionError: [WinError 32] File being used by another process
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM