As part of a larger program, I am using
a subprocess.call('some external program', shell=True)
(It is an old C program and I only have the compiled version sitting on a network server, so I can't just grab the C source code and interface it with Python)
to temporarily generate some data, which I read into Python again.
The problem is that the external program called via subprocess sometimes gets stuck on certain input files.
Is there a way to skip the subprocess.call()
, e.g., if the shell doesn't respond after some arbitrary time limit?
E.g.,
# for data in directory:
# do sth.
subprocess.call('call prog.', shell=True) # skip if takes longer than 5 min
# analyze data