jflessau / winbot-twitter-bot

Twitter contest bot trained to win giveaways.
MIT License
21 stars 2 forks source link

two tracebacks #14

Closed s4cu closed 6 years ago

s4cu commented 6 years ago

After the bot finds a tweet to retweet, I get this message:

Traceback (most recent call last): File "/private/var/root/Downloads/winbot-twitter-bot-master/winbot.py", line 167, in follow_user twitter.create_friendship(screen_name=screen_name) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twython/endpoints.py", line 388, in create_friendship return self.post('friendships/create', params=params) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twython/api.py", line 268, in post return self.request(endpoint, 'POST', params=params, version=version) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twython/api.py", line 258, in request api_call=url) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twython/api.py", line 194, in _request retry_after=response.headers.get('X-Rate-Limit-Reset')) twython.exceptions.TwythonAuthError: Twitter API returned a 401 (Unauthorized), An error occurred processing your request.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/private/var/root/Downloads/winbot-twitter-bot-master/winbot.py", line 289, in win_things() File "/private/var/root/Downloads/winbot-twitter-bot-master/winbot.py", line 35, in win_things get_intimate_with(filtered_tweets) File "/private/var/root/Downloads/winbot-twitter-bot-master/winbot.py", line 116, in get_intimate_with follow_author(tweet) File "/private/var/root/Downloads/winbot-twitter-bot-master/winbot.py", line 177, in follow_author followed_num = follow_user(tweet["user"]["screen_name"]) File "/private/var/root/Downloads/winbot-twitter-bot-master/winbot.py", line 171, in follow_user print("FAILED to follow " + screen_name.encode("ascii", "ignore")) TypeError: must be str, not bytes

Latlanh commented 6 years ago

I have the same issue, I have add .decode('utf-8') after each .encode("ascii", "ignore") maybe we can just remove .encode("ascii", "ignore"). After add .decode('utf-8') it's ok for me! ;)