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.


    ImportError: cannot import name certs

    Pythonista
    bug requests
    6
    7
    8296
    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.
    • techteej
      techteej last edited by techteej

      Don't know whats up with the problems I've been having lately...Literally this script worked fine yesterday. Looked into it and it shows when the requests module is outdated? Don't think thats the case since I've been on the latest beta since release.

      Reproducible code is here

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

        • Are you on the current Beta?
        • Does from requests import get work from the console?
        • If you unload and relaunch Pythomita, does it work?
        • if you import requests ; reload(requests) does it work?
        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          What can happen, i suspect, is if you cancelled a script while requests was loading, things get all hosed, and reload does not necessarily work. This happens for matplotlib, and some others where there are many packages that get imported.

          The easiest fix is to simply kill pythonista and reload. Another approach which i have had some success with, though it probably depends on the package:

          for m in [m for m in sys.modules if m.startswith('requests')]:   
            del sys.modules[m]
          
          1 Reply Last reply Reply Quote 1
          • Phuket2
            Phuket2 last edited by

            The issues you guys are talking about specifically are out of my depth of knowledge. But i also have some weird things happen when running code. Ran something yesterday ok, next day some problems. I am pretty sure in between I have been running some code that uses threads or something I don't quite understand. Which corrupted something. So when I get strange results, rather than think too much, I just kill Pythonista and re run. Is normally fine
            I only mention because I think it's a good strategy. When I first started with Pythonista, I didn't do that. I was trying to track down bugs in my code that didn't exist.

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

              Restarting Pythonista seemed to solve the problem. Still pretty weird.

              1 Reply Last reply Reply Quote 0
              • georg.viehoever
                georg.viehoever last edited by

                It currently appears to be impossible to get the Python interpreter back into a defined state - short of killing and restarting Pythonista. There are many places where Python keeps state, and you cannot get rid of it by reloading modules.
                A "reset Python interpreter" functionality would help for most cases - only if a binary lib gets into an undefined state would still require the kill/restart procedure.
                Georg

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

                  This same error happens to me every time I cancel a script while importing requests. I get a keyboardinterrupt error and then it breaks until restart.

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