I am trying to upgrade a python script that runs an executable on windows and manages the text output files to a version that uses multiple threaded processes so I can utilize more than one core. I have four separate versions of the executable which each thread knows to access. This part works fine. Where I run into problems is when they are running simultaneously and try to open the (different) output files to ensure they ran correctly and react depending on the contents of the output file.
Specifically, when running three threads, two will crash with the following error, while one continues to work:
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 552, in __bootstrap_inner
self.run()
File "E:\HDA\HDA-1.0.1\Hm-1.0.1.py", line 782, in run
conf = self.conf_file(Run)
File "E:\HDA\HDA-1.0.1\Hm-1.0.1.py", line 729, in conf_file
l = open(self.run_dir(Run)+Run, 'r').readlines() #list of file lines
IOError: [Errno 2] No such file or directory: 'Path/to/Outputfile'
This results from the thread not correctly running the executable (i.e. why 'Path/to/Outputfile' was not created and hence can't be found). But one of the threads does this correctly while the other two cannot. Is there a reason why I can't get multiple threads running different versions of an executable?