Instapy: TypeError: follow_likers() got an unexpected keyword argument 'photos_grab_amount'

Created on 13 May 2018  路  5Comments  路  Source: timgrossmann/InstaPy

Expected Behavior

Firstly I would like to say, that this is the first time I am working with Python and I have zero IT background. I managed to make InstaPy work through hours and hours of googling what I had to do. Simple hashtag following, liking, commenting etc. works like a charm. I am unable to solve this one though, so if you are able to help me, please try to do it in as simple terms as possible. Much obliged!

I am trying to run the "Follow the likers of photos of users", but after successfully logging in, it gives me back an error.

Current Behavior

INFO [2018-05-13 10:15:24] [XXXX] Logged in successfully!
INFO [2018-05-13 10:15:30] [XXXX] Session ended - 2018-05-13 10:15:30
INFO [2018-05-13 10:15:30] [XXXX] --------------------

Traceback (most recent call last):
File "followlikers.py", line 47, in
session.follow_likers (['user1'], photos_grab_amount=5, follow_likers_per_photo=10, randomize=True, sleep_delay=600, interact=True)
TypeError: follow_likers() got an unexpected keyword argument 'photos_grab_amount'

Possible Solution (optional)

InstaPy configuration

session.login()

# settings
session.set_relationship_bounds(enabled=False,
             potency_ratio=-1.21,
              delimit_by_numbers=True,
               max_followers=10000000000,
                max_following=10000000000,
                 min_followers=50,
                  min_following=300)

session.set_do_comment(False, percentage=20)
session.set_comments(['Comment1'])
session.set_dont_include([])
session.set_dont_like([])
session.set_do_follow(enabled=False, percentage=35, times=2)

session.set_user_interact(amount=2,
             percentage=70,
              randomize=True,
               media='Photo')
session.follow_likers (['user1'], photos_grab_amount=5, follow_likers_per_photo=10, randomize=True, sleep_delay=600, interact=True)
session.set_do_follow(enabled=True, percentage=70)
session.set_do_like(enabled=True, percentage=70)
session.set_comments(["Cool", "Super!"])
session.set_do_comment(enabled=True, percentage=80)


# actions
session.like_by_tags(['tag1'], amount=1)

Most helpful comment

Hi @uluQulu
well, that worked like a charm. I think you are good, skip that course and keep doing good!

Thank you very, very much indeed.

All 5 comments

hi @positivez,
Check instapy.py file and see if the follow_likers method has photos_grab_amount parameter

def follow_likers (self, usernames, photos_grab_amount=3, follow_likers_per_photo=3, randomize=True, sleep_delay=600, interact=False):

And make sure you are running the latest files.
Good luck!

Thanks @uluQulu was having this same issue and pulled the most recent commits and the issue was resolved. Much appreciated.

Hi @uluQulu

That did solve the error I was getting, thank you very much for that. It does provide me with a new one though. I adjusted the instapy.py as suggested by you (and left the rest as it was) to the following:

def follow_likers(self, usernames, photos_grab_amount=3, follow_likers_per_photo=3, randomize=True, sleep_delay=600, interact=False):
        if not isinstance(photo_urls, list):
            photo_urls = [photo_urls]
        for photo_url in photo_urls:
            user_liked_list = users_liked (self.browser, photo_url, amount)
            self.follow_by_list(user_liked_list[:amount])
        return self

Unfortunatelly this leaves me with:

File "followlikers.py", line 47, in
session.follow_likers (['user1'], photos_grab_amount=5, follow_likers_per_photo=10, randomize=True, sleep_delay=600, interact=True)
File "C:\Users\XX\InstaPy\instapy\instapy.py", line 531, in follow_likers
if not isinstance(photo_urls, list):
UnboundLocalError: local variable 'photo_urls' referenced before assignment

Do you have any further suggestions? Other than the obvious "take a python course"? 馃槂

Cheers and your help is much appreciated!

Welcome @positivez,
The body of the follow_likers definition in your logs belongs to the old design and it now is deprecated.
Recently follow_user_likers and follow_likers were merged together and follow_user_likers was renamed to follow_likers.
So, for you, I would say pull the latest files and it would be much prettier.
Actually, I understand, you might have personal modifications that you do not want to pull entire files, but also understand that, last times InstaPy is getting major changes, and it will be painful for you to apply them manually, just pull all files and keep your modifications separately than main files xD

Actually I also need that python course xD

Hi @uluQulu
well, that worked like a charm. I think you are good, skip that course and keep doing good!

Thank you very, very much indeed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thisishotdog picture thisishotdog  路  3Comments

ingorichter picture ingorichter  路  3Comments

neomh picture neomh  路  3Comments

harrypython picture harrypython  路  3Comments

rahulkapoor90 picture rahulkapoor90  路  3Comments