I wrote a Python script that goes forever in a while true loop and runs other Python scripts by interval like this:
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:
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". The script with the while loop also gets terminated. Any idea on why I receive this error and why the script with the while loop gets terminated? Or an alternative solution that can work in Python (without using batches or windows task schedulers)?
Update:
There is a discussion on Blender's forum about [WinError 223]. It seems like an add-on in Blender also causes this error. The answer of 'Pedro A.' says that a line in the code which tries to use "os.system" causes this error. When this line of code removed the add-on works fine and throws no more error. Link: https://projects.blender.org/blender/blender/issues/99440
Still couldn't find a fix or real cause behind it. Any help will be much appreciated.
I also ran into the issue. After trying out multiple ways to fix it, what helped me was restarting the PC. It solved my issue.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With