omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    3
    6
    3216
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ihf
      ihf last edited by ihf

      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?

      1 Reply Last reply Reply Quote 0
      • abcabc
        abcabc last edited by

        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.)

        1 Reply Last reply Reply Quote 0
        • ihf
          ihf last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • abcabc
            abcabc last edited by

            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 ...>
            
            1 Reply Last reply Reply Quote 0
            • ihf
              ihf last edited by

              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!

              1 Reply Last reply Reply Quote 0
              • ccc
                ccc last edited by

                Yes. Six 1.6.1 is built into Pythonista.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors