2

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.

0asir
  • 21
  • 7

2 Answers2

3

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

user2017037
  • 80
  • 11
0

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
arianvc
  • 101
  • 10