0asir
0asir

Reputation: 21

Module 'instaloader' has no attribute 'Instaloader'

I'm trying to use a little script that gets instagram posts on specific period

That's the code:

from datetime import datetime
from itertools import dropwhile, takewhile
import instaloader

# Get instance
L = instaloader.Instaloader()


posts = instaloader.Profile.from_username(L.context, PROFILE).get_posts()

SINCE = datetime(2019, 4, 1)
UNTIL = datetime(2015, 4, 23)

for post in takewhile(lambda p: p.date > UNTIL, dropwhile(lambda p: p.date > SINCE, posts)):
    print(post.date)
    L.download_post(post)

When the script runs just prints this: module 'instaloader' has no attribute 'Instaloader'

Yes, I have installed the module.

Upvotes: 2

Views: 2963

Answers (2)

user2017037
user2017037

Reputation: 80

If your project name is instaloader.py try to rename it in different, because it's the same as lib's name.

Upvotes: 3

arianvc
arianvc

Reputation: 101

If you're running on ipython (Jupyter) or Idle, it is possible that they are using the default python environment and not the virtualenv you run the command from.

For ipython (Jupyter) see this.

For idle use:

(venv)$ python -m idlelib.idle file.py

Upvotes: 0

Related Questions