Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to discard a Potion crashes the bot #5266

Closed
tiagoAnon opened this issue Sep 7, 2016 · 2 comments
Closed

Failing to discard a Potion crashes the bot #5266

tiagoAnon opened this issue Sep 7, 2016 · 2 comments
Labels

Comments

@tiagoAnon
Copy link

===============ISSUE SECTION===============

The bot tried to discard a potion and the message "[ItemRecycler] [INFO] Failed to discard Potion" appeared, but the bot crashed right after. It happened quite a few times, it almost seems like Niantic is trying to filter bot behavior...

Expected Behavior

The bot should not crash.

Actual Behavior

The bot crashes.

Output when issue occurred

Traceback (most recent call last): File "pokecli.py", line 803, in <module> main() File "pokecli.py", line 161, in main bot.tick() File "/Users/KTachyon/Development/Independent/PoGoBot/PokemonGo-Bot/pokemongo_bot/__init__.py", line 685, in tick if worker.work() == WorkerResult.RUNNING: File "/Users/KTachyon/Development/Independent/PoGoBot/PokemonGo-Bot/pokemongo_bot/cell_workers/recycle_items.py", line 170, in work this_worker_result = self.recycle_excess_category_max(self.max_potions_keep, [101,102,103,104]) File "/Users/KTachyon/Development/Independent/PoGoBot/PokemonGo-Bot/pokemongo_bot/cell_workers/recycle_items.py", line 210, in recycle_excess_category_max if inventory.items().get(item[0]).recycle(item[1]) == WorkerResult.ERROR: File "/Users/KTachyon/Development/Independent/PoGoBot/PokemonGo-Bot/pokemongo_bot/inventory.py", line 219, in recycle raise Exception('Tried to remove more {} than you have'.format(self.name)) Exception: Tried to remove more Potion than you have [2016-09-07 17:56:36] [MainThread] [sentry.errors] [ERROR] Sentry responded with an error: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128) (url: https://app.getsentry.com/api/90254/store/) Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync super(ThreadedHTTPTransport, self).send(data, headers) File "/usr/local/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send ca_certs=self.ca_certs, File "/usr/local/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen return opener.open(url, data, timeout) File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open response = self._open(req, data) File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open '_open', req) File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain result = func(*args) File "/usr/local/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open return self.do_open(ValidHTTPSConnection, req) File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 1284, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request self._send_request(method, url, body, headers) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request self.endheaders(body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders self._send_output(message_body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 891, in _send_output msg += message_body UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128) [2016-09-07 17:56:36] [MainThread] [sentry.errors.uncaught] [ERROR] [u'Exception: Tried to remove more Potion than you have', u' File "pokecli.py", line 803, in <module>', u' File "pokecli.py", line 161, in main', u' File "pokemongo_bot/__init__.py", line 685, in tick', u' File "pokemongo_bot/cell_workers/recycle_items.py", line 170, in work', u' File "pokemongo_bot/cell_workers/recycle_items.py", line 210, in recycle_excess_category_max', u' File "pokemongo_bot/inventory.py", line 219, in recycle'] Wed Sep 7 17:56:36 WEST 2016 Pokebot Stopped. Press any button or wait 20 seconds to continue.

Steps to Reproduce

You will have to wait for the bot to pick up a potion from a pokestop and fail to recycle it.

Other Information

OS:
OS X
Branch:
dev
Git Commit:
1b8cf13
Python Version:
Python 2.7.11

@DeXtroTip DeXtroTip added the Bug label Sep 8, 2016
@Gobberwart
Copy link
Contributor

Change to pokecli.py line 801 should fix this:

def parse_unicode_str(string):
    try:
        return string.decode('utf8')
    except (UnicodeEncodeError,UnicodeDecodeError):
        return string

But more importantly... why is the bot failing to discard a potion?

@Gobberwart
Copy link
Contributor

PR #5312 submitted to fix crash, not underlying discard error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants