Instapy: Traceback: Missing 1 required positional argument: 'logger'

Created on 18 May 2018  路  8Comments  路  Source: timgrossmann/InstaPy

InstaPy was running smooth until the latest release with this error:

Could not locate Chrome: Message: no such session
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.16299 x86_64)

It either starts up and gives this error in general.log or it crashes with same error after a few likes, or even a hundred likes. Random.
Update: I may have looked at a log from before, it's just randomly ending now, without warning. Is there any way I can get a dump of what happened?

Most helpful comment

It is a good practice to update these packages _regularly_:
selenium, emoji (_for comments_), requests (_for clarifai_), wheel and setuptools with,

#e.g.,
pip install -U emoji

and upgrade pip itself with,

python -m pip install --upgrade pip

I think, since your quickstart script will have a try/except/finally block with raise in except block, it will output any exception occurred easily.

And that TypeError you have encountered lately is fixed in #2042 (_read https://github.com/timgrossmann/InstaPy/issues/2049#issuecomment-390269641_ for more details).

All 8 comments

If you share a template of your quickstart script, we can guess some solution.
Also what do you see in console output when it ends randomly or crashes?

I am having the same problem... Chromedriver is updated. Chrome and Chromium, too. It' appears to be completed random. Sometimes, on the unfollowing process, sometimes, on the following process. Any solution? My platform is Linux-Fedora.

Here is my full quickstart.py, I think I had it as close as possible to the original:
As for console output I haven't seen when it crashes but I will leave a screencap on and update ya'll in a few hours.

# -*- coding: utf-8 -*-
import os
import time
from tempfile import gettempdir

from selenium.common.exceptions import NoSuchElementException

from instapy import InstaPy

insta_username = 'little_brosen'
insta_password = 'insertpassword'

#   set headless_browser=True if you want to run InstaPy on a server

#   set these in instapy/settings.py if you're locating the
#   library in the /usr/lib/pythonX.X/ directory:
#   Settings.database_location = '/path/to/instapy.db'
#   Settings.chromedriver_location = '/path/to/chromedriver'

session = InstaPy(username=insta_username,
                  password=insta_password,
                  use_firefox=False)

try:
    session.login()

    # Settings #
    session.set_relationship_bounds(enabled=True,
                  delimit_by_numbers=True,
                   max_followers=4590,
                    max_following=7855,
                     min_followers=10,
                      min_following=15)
    session.set_sleep_reduce(80)
    session.set_do_comment(True, percentage=10)
    session.set_comments(['aMEIzing!', u'Nice', u'Did you see that?', u'馃敟馃敟', u'馃挴', u'馃挵'])
    session.set_dont_include(['friend1', 'friend2', 'friend3'])
    session.set_dont_like(['bannedtags'])

    # Action Campaign # 365 USA #
    #session.like_by_locations(['214538524/san-luis-obispo-california/?hl=en'], amount=5)
    #session.like_by_locations(['213366430/augusta-maine/'], amount=15)
    #session.like_by_locations(['214492793/tallahassee-florida/?hl=en'], amount=35)
    #session.like_by_locations(['216749148/harrisburg-pennsylvania/'], amount=25)
    #session.like_by_locations(['239707761/helena-montana/?hl=en'], amount=15)
    #session.like_by_locations(['214538524/san-luis-obispo-california/?hl=en'], amount=45)
    #session.like_by_locations(['213906459/santa-maria-california/'], amount=35)
    #session.like_by_locations(['213346916/pismo-beach-california/'], amount=25)
    #session.like_by_locations(['212964995/austin-texas/?hl=en'], amount=25)
    #session.like_by_locations(['4599325/denver-colorado/?hl=en'], amount=25)
    #session.like_by_locations(['213728334/colorado-springs-colorado/'], amount=35)
    #session.like_by_locations(['214293437/santa-fe-new-mexico/?hl=en'], amount=25)
    #session.like_by_locations(['217077667/boise-idaho/?hl=en'], amount=25)
    #session.like_by_locations(['212901056/las-vegas-nevada/'], amount=15)
    #session.like_by_locations(['212931804/sacramento-california/'], amount=15)
    # Action Campaign # 2K Diverse #
    session.like_by_tags(['premiere'], amount=82)
    session.like_by_locations(['213953267/honolulu-hawaii/'], amount=85)
    session.like_by_tags(['math'], amount=35)
    session.like_by_locations(['26914683/santiago-chile/'], amount=77)
    session.like_by_locations(['212996687/auckland-new-zealand/'], amount=95)
    session.like_by_locations(['116231/amsterdam-netherlands/'], amount=45)
    session.like_by_locations(['259514507/maui-hawaii/'], amount=127)
    session.like_by_tags(['like4follow'], amount=124)
    session.like_by_locations(['213755156/tehran-iran/'], amount=74)
    session.like_by_locations(['213211804/oslo-norway/'], amount=88)
    session.like_by_locations(['213941548/seattle-washington/'], amount=95)
    session.like_by_locations(['213264682/almaty-kazakhstan/'], amount=85)
    session.like_by_tags(['love'], amount=97)
    session.like_by_locations(['215244473/bangalore-india/'], amount=105)
    session.like_by_tags(['instagood'], amount=94)
    session.like_by_tags(['picoftheday'], amount=62)
    session.like_by_tags(['food'], amount=89)
    session.like_by_locations(['213633143/brussels-belgium/'], amount=151)
    session.like_by_locations(['213742495/jerusalem-israel/'], amount=109)
    session.like_by_tags(['smile'], amount=73)
    session.like_by_locations(['778773524/yangon-myanmar-burma/?hl=en'], amount=132)
    session.like_by_tags(['me'], amount=76)

except Exception as exc:
    # if changes to IG layout, upload the file to help us locate the change
    if isinstance(exc, NoSuchElementException):
        file_path = os.path.join(gettempdir(), '{}.html'.format(time.strftime('%Y%m%d-%H%M%S')))
        with open(file_path, 'wb') as fp:
            fp.write(session.browser.page_source.encode('utf8'))
        print('{0}\nIf raising an issue, please also upload the file located at:\n{1}\n{0}'.format(
            '*' * 70, file_path))
    # full stacktrace when raising Github issue
    raise

finally:
    # end the bot session
    session.end()

Update: I git bash in instapy home folder, and pip install selenium. It tells me there is a selenium update. Hopefully this fixed it, right now it's smooth. 2 things I need to know is how to switch off chromedriver and get firefox webdriver, as well as how to get a full stack trace or dump or whatever it is.

Well it did run smooth. I finally caught it on screen recording:
capture2

Chromedriver crashed first with no warning, session ends, and that traceback happens
traceback

It is a good practice to update these packages _regularly_:
selenium, emoji (_for comments_), requests (_for clarifai_), wheel and setuptools with,

#e.g.,
pip install -U emoji

and upgrade pip itself with,

python -m pip install --upgrade pip

I think, since your quickstart script will have a try/except/finally block with raise in except block, it will output any exception occurred easily.

And that TypeError you have encountered lately is fixed in #2042 (_read https://github.com/timgrossmann/InstaPy/issues/2049#issuecomment-390269641_ for more details).

snip

Is instagram-py 0.0.1 only able to handle a certain selenium and clarifai requests version? Not sure if I am getting errors or if those versions aren't needed.
btw I am not using clarifai if this helps. Thank you for your time and help uluQulu.

Not at all,
If you don't use clarifai, you don't need to install requests package
This project- its source code uses those packages and it is best to use latest versions.
instagram-py 0.0.1 is just kind of a release and it's requirements lines are not updated that's why you see it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CharlesCCC picture CharlesCCC  路  3Comments

CodeMaster1 picture CodeMaster1  路  3Comments

thisishotdog picture thisishotdog  路  3Comments

neomh picture neomh  路  3Comments

deronsizemore picture deronsizemore  路  3Comments