-
Notifications
You must be signed in to change notification settings - Fork 52
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
ImportError: cannot import name Timeouterror #9
Comments
That's a typo in the docs, it should be |
Thank you, sorry for that, I should have found it... I had to add The code is : #!/usr/bin/env python
# -*- coding: utf-8 -*-
# From http://pythonhosted.org/Pebble/#examples
from pebble import ProcessPool
from pebble.common import ProcessExpired
from concurrent.futures import TimeoutError
def function(foo, bar=0):
return foo + bar
elements = list(range(1000))
with ProcessPool() as pool:
iterator = pool.map(function, elements, timeout=10)
while True:
try:
results = next(iterator)
print(results)
except TimeoutError as error:
print("Function took longer than %d seconds" % error.args[1])
except ProcessExpired as error:
print("%s. Exit code: %d" % (error, error.exitcode))
except Exception as error:
print("function raised %s" % error)
print(error.traceback) # Python's traceback of remote process
except StopIteration:
break Now the execution starts but at the end there are the two errors below :
and
This leads to the second issue |
I will update the documentation making sure all examples are correct. Keep in mind that the order of exceptions is important.
This logic won't raise the |
Ok I understand ! |
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
Fixed in release 4.3.1. |
With release 4.2.1 on Mac OSX : There is an error running your example on http://pythonhosted.org/Pebble/#examples
At the very beginning on the line
from concurrent.futures import Timeouterror
this throws ImportError error : cannot import name Timeouterror
Thank you in advance.
The text was updated successfully, but these errors were encountered: