Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
retrying
-
I wanted to see if the retrying library would work. I used pip install under stash to install retrying (and six which seemed to be a dependency). Installed seemed to work but I tested and got this:
from retrying import retry
import random@retry
def unrealiable():
... if random.randint(0,10) > 1:
... raise IOError("broken")
... else:
... return "awesome"
...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/mobile/Containers/Shared/AppGroup/637EEB4B-60E1-4F48-A8E5-66F2C7D9FCA2/Documents/site-packages/retrying.py", line 42, in retry
return wrap_simple(dargs[0])
File "/private/var/mobile/Containers/Shared/AppGroup/637EEB4B-60E1-4F48-A8E5-66F2C7D9FCA2/Documents/site-packages/retrying.py", line 36, in wrap_simple
@six.wraps(f)
AttributeError: 'module' object has no attribute 'wraps'Can anyone please tell me what I'm missing?
-
The version of the six module included in pythonista does not seem to have 'wraps' function. I did "pip install six" and then tried running the program. It worked. (After doing pip, reload pythonista. Otherwise old copy will be used.)
-
That's interesting because, not knowing that the six module was in Pythonista, I also did the pip install yet @retry fails. Can you reproduce the error I am seeing or does @retry work for you?
-
Initially it gave the error that you have mentioned (i.e I am able to reproduce it. ) After installing six it works fine.
Try this code to check whether you have installed six properly
import six print(six.__version__) print(six.wraps)
Before the new six installation it prints "1.6.1" and gives error.
After the new six installation, it prints as follows.
1.10.0 <functions wraps at ...>
-
I think the problem must have been that I was not explicitly doing the import six so it must have been using the older version (without wraps). In any case it is working now. Thanks for your help!
-
Yes. Six 1.6.1 is built into Pythonista.