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
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
ccc last edited by
- Are you on the current Beta?
from requests import getwork from the console?
- If you unload and relaunch Pythomita, does it work?
- if you
import requests ; reload(requests)does it work?
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]
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.
techteej last edited by
Restarting Pythonista seemed to solve the problem. Still pretty weird.
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.
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.