タイトルが示すように、いくつかのexecfile
呼び出しを実行しようとしていますが、呼び出されたスクリプトの実行に10秒以上かかる場合、呼び出されたスクリプトを強制終了して続行するようにタイムアウトオプションを探しています...
シグナル ライブラリ/パッケージは UNIX 専用です。私は Windows を使用しているので、少し行き詰まっています。
# Sequential wait to finish before moving onto the next script
try:
execfile("SUBSCRIPTS/TESTSCRIPT.py", {})
except Exception:
errors.write(traceback.format_exc() + '\n')
errors.write("\n\n")
# Semi-Sequential (Don't wait for it to finish before moving onto the third script)
subprocess.Popen(["pythonw", "SUBSCRIPTS/TEST.py", "0"], shell=True)
# Sequential wait to finish before moving onto the next script
try:
execfile("SUBSCRIPTS/TEST.py", {})
except Exception:
errors.write(traceback.format_exc() + '\n')
errors.write("\n\n")
# Sequential wait to finish before moving onto the next script
try:
execfile("SUBSCRIPTS/TESTSCRIPT.py", {})
except Exception:
errors.write(traceback.format_exc() + '\n')
errors.write("\n\n")
何か案は?