Code:
def follow_hashtag_commenters(username, password, hashtags):
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument('-proxy', type=str, help="proxy")
args = parser.parse_args()
bot = Bot(max_likes_per_day=35, max_follows_per_day=40, max_comments_per_day=40)
bot.login(username=username, password=password, proxy=args.proxy)
user_id = bot.get_user_id_from_username(username)
.
.
.
Error/Debug Log:
Cookie file `cookie.txt` not found
2018-09-11 17:24:08,139 - INFO - Logged-in successfully as 'xxx'!
2018-09-11 17:24:08,140 - INFO - Saved cookie!
127.0.0.1 - - [11/Sep/2018 17:24:08] "GET /follow_hashtag_commenters?username=xxx&password=yyy&hashtags=zzz HTTP/1.1" 500 -
Traceback (most recent call last):
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/admin/Desktop/first_app/py/main.py", line 14, in fhc
instaapp.follow_hashtag_commenters(username, password, hashtags)
File "/Users/admin/Desktop/first_app/py/instaapp.py", line 19, in follow_hashtag_commenters
bot.login(username=username, password=password, proxy=args.proxy)
File "/Users/admin/Desktop/instabot-venv/lib/python3.6/site-packages/instabot/bot/bot.py", line 237, in login
signal.signal(signal.SIGTERM, self.logout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
If I enter a correct username and password (I tried 4 personal account), this will happen. If I put wrong credential, it works normally. Before today, everything was fine. now, I am facing with this error without make any changes in my code.
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.
Hey @md4956
I am facing same issue. Have you resolve this problem ?
Hi @ghyath5
With this repository's solutions, no. I've fixed it by creating a multi-thread process, using another library.
You can pass is_threaded=True to bot.login() to avoid this issue.
From bot.login():
if "is_threaded" in args:
if args["is_threaded"]:
return True
signal.signal(signal.SIGTERM, self.print_counters)
Most helpful comment
You can pass
is_threaded=Truetobot.login()to avoid this issue.From bot.login():