-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It can't support in windows #45
Comments
dear xixiao, yours sincerely Robert |
Thanks! Error message: |
Dear Xixiao, so smt. like :
yours sincerely Robert |
I also have a request. If the function timeout. Error message will also show~ |
You can already customize the exception message :
|
Thank you! |
Dear Xiaxiao,
we use wrapt, what is more persistent, especially when You debug in pycharm. Also it provides better support in decorating methods of classes, static methods, etc.:
but most important for windows is, that we use "dill + multiprocess" instead of "pickle + multiprocessing" - distinct "multiprocess" != "multiprocessing" !!!
since we dont have signals in Windows, we need to run the decorated function in a seperate process that can be terminated after the timeout occurs (You can not terminate threads). pickle is somehow limited, dill can serialize more types then pickle. conclusion: #3 as a windows programmer You want to use "dill + multiprocess" instead of "pickle + multiprocessing". I use it also on Linux, since I have not found any disadvantages. (although dill is a little bit slower than pickle - but the difference is negligable unless You pickle tenthousands of objects) #4 You might try :
yours sincerely Robert |
import time
from timeout_decorator import *
@timeout(5)
def mytest(message):
print(message)
for i in range(1,10):
time.sleep(1)
print('{} seconds have passed'.format(i))
def main():
try:
mytest('starting')
except TimeoutError:
print('whatever You want')
if __name__ == '__main__':
main() raise error:
|
You use pnpnpn´s timeout decorator from here - so You need to put use_signals=False on windows, so:
my fork does that automatically, You can look here : https://github.com/bitranox/wrapt-timeout-decorator yours sincerely Robert |
Maybe it's the problem that windows didn't support signal well.
But do you have any solution ?
The text was updated successfully, but these errors were encountered: