I am using python 2.7 on my Mac using a virtual environment. The trying to import InstaPy I get this error.
Traceback (most recent call last):
File "insta.py", line 2, in <module>
from instapy import InstaPy
ImportError: cannot import name InstaPy
I installed it like the readme and did not miss anything. Is there a python requirement that I am missing?
@jmurphy45 Looks like you have to put your file in the root directory of the InstaPy folder.
Make sure to locate your file just where the quickstart.pyis
So there is no way to make it global in my virtual environment so that I can use other libraries with it?
I have these tow imports.
from InstagramAPI import InstagramAPI
from instapy import InstaPy
The tow libraries are in the sr folder and the my script is outside of the src folder.
Well, if you put it in the root folder of InstaPy, you can still import all the other global stuff (like e.g. the InstagramAPI)
Publishing InstaPy on PyPi is one the list, but this will take some more time
Strange we can't call InstaPy from the parent folder, I don't want to mix quickstart.py with InstaPy lib, so I did put quickstart.py in the parent folder. I'm having a hard time running quickstart.py (probably because I'm a beginner in python :))
@julesbou what are you trying to achieve ?
InstaPy lib is at /InstaPy/instapy/ folder
quickstart.py must be at /InstaPy folder because it's setup to call InstaPy module located at /InstaPy/instapy/
@converge thanks for clarification, I was just trying to have quickstart.py separated from InstaPy lib, apparently this is not the correct way to do it, so I will do as you suggest, thanks
@julesbou if you really need that, you can try it:
https://stackoverflow.com/questions/4383571/importing-files-from-different-folder
Did anyone find a solution for this problem? I want to move all own scripts outside the InstaPy folder to make it update-able. The solutions provided in stackoverflow don't work for me.
Neither does from InstaPy.instapy import InstaPy (when accessing from parent folder) nor
import sys
sys.path.insert(0, '/home/username/instagram-bot/InstaPy/')
work for me.