[Solved]ImportError when importing Images, Twitter and more
I should of course have just looked for a Twitter module in the pythonista documentation, which I did after installing python-twitter and realized I should just use that.
There was just one problem:
raised the following error:
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
This doesn't just happen when I import twitter, but also with Images, when I run my script the uploads pictures to Imgur and when I open the pythonista 3 widget from the share menu.
The problem that you have is that Pythonista already comes with a module built in that you access with
import twitterand then you installed a second, different module that you also access with
import twitter. You now have a namespace collision and those two modules are colliding in ways that might be difficult to disentangle.
Yes, I thought it was something like that :/
But why does this affect other modules?
@ccc and now it raised a new error
module "copyreq" has no attribute "pickle"
Damn I wish there was a undo button in stash
Anything you installed in stash can be found by going to
then, if you find a folder you don't want, simply delete it
rm -rf twitter
if you have already imported the module, force quit pythonista, then restart, and you should be good to go.
@JonB didn't quite work.
I did remove the twitter folder, but now it's just back to the first error.
And I'm still wondering why this affects other modules. The ImportError says I'm either running Python-future from the src folder or it's corrupted, it think it's corrupted
So, to be clear:
if you type
import twitterin the console, running the 3.5 interpreter, you get that error?
What about from the 2.7 interpreter.
Make sure you don't have another twitter.py somewhere...
oh, the problem is that python twitter also installed future, since stash runs py2.7.
Delete future from site packages as well
@JonB future is now gone.
All I'm doing is
It doesn't work in 3.5
It works in 2.7
From the console(2.7):
>>> import twitter >>> twitter.__file__ '/var/containers/Bundle/Application/05B93F09-B103-44A6-9622-55237A53AC5E/Pythonista3.app/Frameworks/PythonistaKit.framework/pylib/site-packages/twitter.py'
@JonB is everything in site-packages what stash has installed?
If so, wouldn't trashing it all fix the problem?
stashsaves packages installed via
site-packagesfolder, but I wouldn't delete everything. Just look if there is a folder named Twitter in
site-packagesAnd try renaming/deleting that one
@lukaskollmer I got it all working again, except imgurpython.
I removed it from site-packages and tried to reinstall it with pip, but it wouldn't let me.