timeout-decorator
timeout-decorator copied to clipboard
Unexpected behaviour when using timeout
Hi, Here in python_runner.py file i am reading a python file(myscript.py) and running the script with timeout.
python_runner.py:
import timeout_decorator
try:
@timeout_decorator.timeout(5)
def execute_script_file_with_timeout():
exec(open(myscript.py).read())
execute_script_file_with_timeout()
except timeout_decorator.timeout_decorator.TimeoutError:
print("Task Execution Timeout")
when i use this script in myscript.py, this is working as expected.
import random
import string
print("\n".join("".join(random.choices(string.ascii_uppercase, k=1024))))
when i use this script in myscript.py,
import random
import string
print("\n".join("".join(random.choices(string.ascii_uppercase, k=1024)) for _ in range(1024)))
i am getting below error,
Traceback (most recent call last):
File "python_runner.py", line 56, in
Thanks, Raghu