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.


    [SOLVED] 160025 - requests (and smtplib) module broken

    Pythonista
    4
    7
    4141
    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.
    • userista
      userista last edited by userista

      import requests
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/private/var/mobile/Containers/Bundle/Application/F7C28751-D087-40E9-BD22-C79FB689A145/Pythonista.app/pylib/site-packages/requests/__init__.py", line 53, in <module>
          from .packages.urllib3.contrib import pyopenssl
        File "/private/var/mobile/Containers/Bundle/Application/F7C28751-D087-40E9-BD22-C79FB689A145/Pythonista.app/pylib/site-packages/requests/packages/__init__.py", line 3, in <module>
          from . import urllib3
        File "/private/var/mobile/Containers/Bundle/Application/F7C28751-D087-40E9-BD22-C79FB689A145/Pythonista.app/pylib/site-packages/requests/packages/urllib3/__init__.py", line 11, in <module>
          from .connectionpool import (
        File "/private/var/mobile/Containers/Bundle/Application/F7C28751-D087-40E9-BD22-C79FB689A145/Pythonista.app/pylib/site-packages/requests/packages/urllib3/connectionpool.py", line 37, in <module>
          from .request import RequestMethods
        File "/private/var/mobile/Containers/Bundle/Application/F7C28751-D087-40E9-BD22-C79FB689A145/Pythonista.app/pylib/site-packages/requests/packages/urllib3/request.py", line 6, in <module>
          from .filepost import encode_multipart_formdata
        File "/private/var/mobile/Containers/Bundle/Application/F7C28751-D087-40E9-BD22-C79FB689A145/Pythonista.app/pylib/site-packages/requests/packages/urllib3/filepost.py", line 8, in <module>
          from .fields import RequestField
        File "/private/var/mobile/Containers/Bundle/Application/F7C28751-D087-40E9-BD22-C79FB689A145/Pythonista.app/pylib/site-packages/requests/packages/urllib3/fields.py", line 1, in <module>
          import email.utils
        File "/private/var/mobile/Containers/Shared/AppGroup/FA9B640E-6D58-4A63-B962-B8D73AEC123E/Documents/email.py", line 3
          import smtplib
                       ^
      IndentationError: unindent does not match any outer indentation level
      
      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        Hmm, it looks like this is a side effect of the changed import path order. You apparently have a file named email.py in your documents – that is treated as a module and hides the standard library module of the same name.

        For now, you can work around this by just renaming your own email.py file to something else, but I think I might need to make a change there, so that only things in site-packages can override library modules, but not things in the main documents folder...

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

          Oh you're right. Sorry about that

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

            I'm also having some trouble with my script not seeing a file in the same folder as it. Another side effect?

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

              @Webmaster4o It's because of this: https://forum.omz-software.com/topic/2089/160025-import-from-same-directory/4 – will be fixed in the next build. Until then, you can use ywangd's workaround.

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

                Saw that, thanks :)

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

                  I had the same issue. Workaround worked.

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