Instapy: Instant cmd termination: 'InstaPy' object has no attribute 'logger'

Created on 29 Jan 2018  路  15Comments  路  Source: timgrossmann/InstaPy

Expected Behavior

Start chrome, run the bot

Current Behavior

Instant cmd termination - Powershell says (username and pw changed to xxx):

PS C:\Users\david\Documents\GitHub\InstaPy> py quickstart.py
Traceback (most recent call last):
File "quickstart.py", line 4, in
session = InstaPy(username='xxx', password='xxx')
File "C:\Users\david\Documents\GitHub\InstaPy\instapy\instapy.py", line 131, in __init__
self.logger = self.get_instapy_logger(show_logs)
File "C:\Users\david\Documents\GitHub\InstaPy\instapy\instapy.py", line 165, in get_instapy_logger
self.logger = logging.LoggerAdapter(self.logger, extra)
AttributeError: 'InstaPy' object has no attribute 'logger'

On my notebook the bot works sort of fine (still getting that bug where only 12 posts are liked). Tried it on my main machine today and can't get past the basic setup.

Tried looking the issue up, but only found something about "aborting" or something about different lines.

InstaPy configuration

completely basic was just used for testing - quickstart:
from instapy import InstaPy
import os

session = InstaPy(username='xxx', password='xxx')

session.login()

session.like_by_tags(['fitinn'], amount=50, media='Photo')

session.end()

Dowloaded and installed all software by the books and up-to-date
Python 3.6.4
Chromedriver 2.35
Up-to-date repository from github
Win 10 Pro 64 Bit

Thanks

wontfix

Most helpful comment

@Namaslayer try renaming self.logger to logger in line 165 at instapy.py

self.logger = logging.LoggerAdapter(logger, extra)   #you will change this line to below

becomes

logger = logging.LoggerAdapter(logger, extra)

All 15 comments

Same issue here using basic setup. Also Windows 10. Was running fine as of last night.

Same issue here! fresh install as of about 10 minutes ago.

To update, I reverted to a previous version from a few days ago and it's running fine so something in the new update is causing the error.

@gruvismalt awesome! can you advise on how to do that?

@converge any ideas on how to fix with the current version?

The same thing happens to me, I used the last version of day 27 and everything was fine

@LordSuricato How to you revert back to and older version? I'm not sure how to do this.

I removed the lines added in

https://github.com/timgrossmann/InstaPy/commit/d22808ccaaaec6b1c4b549896942d8536b641f8f#diff-de2ecb8866219bb53ba97e8377a2f26dL154

and put the old removed line back and the script works again.

Alrighty guys, no need to remove those lines, the error is obvious
The error is that it's accessing self.logger before it is ever assigned to
Line 165 of that paste is assigning to self.logger (for the first time), but it is also trying to access self.logger
So let's not do that:
I am thinking that both instances of self.logger on that line should just be logger.

Replace both to plain logger

It's fairly basic that they are different because they refer to entirely different things, logger and self.logger

uluQulu, you're right. I need sleep. #1313 doesn't return the right logger.

hey dave, you should update your commit :-)

@uluQulu just did a git pull and got this long string of errors. Any ideas?

screen shot 2018-01-29 at 11 51 12 pm

Fetched origin and everything works fine again!
(had to change "self.switch_language" to "=False" though)

Thanks for your fast and awesome help!
Keep up the good work

@Namaslayer try renaming self.logger to logger in line 165 at instapy.py

self.logger = logging.LoggerAdapter(logger, extra)   #you will change this line to below

becomes

logger = logging.LoggerAdapter(logger, extra)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ingorichter picture ingorichter  路  3Comments

seuraltimez picture seuraltimez  路  3Comments

neomh picture neomh  路  3Comments

n0sw34r picture n0sw34r  路  3Comments

harrypython picture harrypython  路  3Comments