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

Bot crashes if hunter configuration is not specified #5907

Closed
ashleykleynhans opened this issue Feb 8, 2017 · 3 comments
Closed

Bot crashes if hunter configuration is not specified #5907

ashleykleynhans opened this issue Feb 8, 2017 · 3 comments

Comments

@ashleykleynhans
Copy link
Contributor

Expected Behavior

When the bot starts, it should begin moving to fort, catching Pokemon etc, depending on the options specified within the config.json file.

Actual Behavior

When the bot starts. it crashes with the an error due to the PokemonHunter section not being present in config.json file.

Output when issue occurred

Traceback (most recent call last):
  File "pokecli.py", line 865, in <module>
    main()
  File "pokecli.py", line 206, in main
    bot.tick()
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/pokemongo_bot/__init__.py", line 778, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/pokemongo_bot/cell_workers/catch_pokemon.py", line 55, in work
    if self.bot.hunter_locked_target != None:
AttributeError: 'PokemonGoBot' object has no attribute 'hunter_locked_target'
[2017-02-08 23:25:28] [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 "/Users/ashley/POKEMONGO/PokemonGo-Bot/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/Users/ashley/POKEMONGO/PokemonGo-Bot/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)
[2017-02-08 23:25:28] [sentry.errors.uncaught] [ERROR] [u"AttributeError: 'PokemonGoBot' object has no attribute 'hunter_locked_target'", u'  File "pokecli.py", line 865, in <module>', u'  File "pokecli.py", line 206, in main', u'  File "pokemongo_bot/__init__.py", line 778, in tick', u'  File "pokemongo_bot/cell_workers/catch_pokemon.py", line 55, in work']

Steps to Reproduce

  1. Clone repo
  2. Check out dev branch
  3. Run ./setup -i
  4. Don't have a PokemonHunter section in config.json
  5. Start bot

Other Information

OS: Mac OSX
Branch: dev
Git Commit: 8a677a1
Python Version: Python 2.7.10

@ashleykleynhans
Copy link
Contributor Author

Workaround is to add this to the config.json file

        {
            "type": "PokemonHunter",
            "config": {
                "enabled": false,
                "max_distance": 1500,
                "hunt_all": false,
                "hunt_vip": true,
                "hunt_pokedex": true,
                "lock_on_target": false
            }
        }

But ideally the bot should have better handling of configuration items that aren't specified instead of crashing.

@MerlionRock
Copy link
Contributor

It's already being submitted as buxfix #5904

Waiting to be merged.

@solderzzc
Copy link
Contributor

Merged, thanks for the patch. let me close this issue.

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

No branches or pull requests

3 participants