PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)

Open kyleboe opened this issue 10 years ago • 23 comments

Expected Behavior

Bot will continue to run correctly.

Actual Behavior

After about an hour or so I get get the following error which causes the bot to crash:

Traceback (most recent call last):
  File "pokecli.py", line 501, in <module>
    main()
  File "pokecli.py", line 132, in main
    raise e
TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)

Steps to Reproduce

Let the bot run between 1-2 hours.

Other Information

OS: macOS El Cap 10.11.6 Git Commit: eeecbc6c48d292fc916e4830fba1df290adb6ec4 Python Version: Python 2.7.10

kyleboe avatar Aug 07 '16 17:08 kyleboe

I am updating Python to 2.7.12 right now to see if that has any effect.

EDIT: Updating python has no relation to this issue.

kyleboe avatar Aug 07 '16 17:08 kyleboe

same here with Win 10 64bit:

2016-08-07 19:32:22,121 [       cli] [INFO] Ran for 1:00:11
2016-08-07 19:32:22,124 [       cli] [INFO] Total XP Earned: 25510  Average: 25431.11/h
2016-08-07 19:32:22,124 [       cli] [INFO] Travelled 1.71km
2016-08-07 19:32:22,124 [       cli] [INFO] Visited 55 stops
2016-08-07 19:32:22,125 [       cli] [INFO] Encountered 86 pokemon, 86 caught, 0 released, 9 evolved, 0 never seen before
2016-08-07 19:32:22,125 [       cli] [INFO] Threw 90 pokeballs
2016-08-07 19:32:22,125 [       cli] [INFO] Earned 8600 Stardust
2016-08-07 19:32:22,125 [       cli] [INFO]
2016-08-07 19:32:22,125 [       cli] [INFO] Highest CP Pokemon: Golbat [CP: 1055] [IV: 10/6/4] Potential: 0.44
2016-08-07 19:32:22,125 [       cli] [INFO] Most Perfect Pokemon: Eevee [CP: 79] [IV: 14/15/13] Potential: 0.93
Traceback (most recent call last):
  File "pokecli.py", line 501, in <module>
    main()
  File "pokecli.py", line 132, in main
    raise e
TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)

Git Commit: 6960f35 ("Fixes #2698 - Prevents "Possibly searching too often" error after re-login. (#2771)", 2016-08-08)

zx900930 avatar Aug 07 '16 17:08 zx900930

@zx900930 what version of python are you running?

kyleboe avatar Aug 07 '16 17:08 kyleboe

@kyleboe

$ python --version
Python 2.7.12

zx900930 avatar Aug 07 '16 17:08 zx900930

@zx900930 Interesting. Because we are on different commits, eeecbc6c48d292fc916e4830fba1df290adb6ec4 (mine) vs 6960f356a8d841cefbfd1018b23877b73a6a0d12 (yours), I would recommend updating to the latest commit on the dev branch and trying again to see if the problem persists.

If it does, then maybe the python version is unrelated.

kyleboe avatar Aug 07 '16 18:08 kyleboe

Same issue. Commit: 6960f356a8d841cefbfd1018b23877b73a6a0d12 Python: 2.7.12 Ubuntu 16.04

I don't believe the next commit affects this issue.

Edit: If it is of any help, this happens only my google login bot, but not the ptc one. Same config on both other than the login details.

And its always 1 hour 0 minutes and some seconds. Have seen this happen 3 times while ptc one was running. Both were started at the same time

mrthrowaway avatar Aug 07 '16 18:08 mrthrowaway

Same here. Commit: 6960f35 Python: 2.7.12 Ubuntu 16.04

EDIT: I've just seen it, previous commentor and I got this crash same time, I posted this 3 mins later, so this crash might be something global that affects everyone at the same time

omeryagmurlu avatar Aug 07 '16 18:08 omeryagmurlu

@mrthrowaway same exact thing happens to me. I have have 2 bots running and the PTC one runs just fine while the Google one crashes after exactly an hour and I started both at the exact same time.

kyleboe avatar Aug 07 '16 18:08 kyleboe

Same error

xlren11 avatar Aug 07 '16 21:08 xlren11

Getting this on - OS: Debian 8 Commit: 5b3fe3d (dev branch) Python: 2.7.9

It happens after running for about 30 minutes.

jryd avatar Aug 08 '16 02:08 jryd

Confirmed issue.

PlanetoftheMapes avatar Aug 08 '16 04:08 PlanetoftheMapes

#2864 I raised the same issue.

pranavperfect avatar Aug 08 '16 04:08 pranavperfect

don't know if its the same thing bug the vip crashing the bot. I took it out. 1.35 mins atm

FriskyScooter avatar Aug 08 '16 04:08 FriskyScooter

Mine crashed after exactly one hour also. I'm wondering if the session is becoming "stale."

Something is timing out after 60min.

Traceback (most recent call last): File "pokecli.py", line 502, in main() File "pokecli.py", line 133, in main raise e TypeError: None has type , but expected one of: (, ) 2016-08-08 00:42:11,081 [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 "/home/ben/PokemonGo-Bot/local/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync super(ThreadedHTTPTransport, self).send(data, headers) File "/home/ben/PokemonGo-Bot/local/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send ca_certs=self.ca_certs, File "/home/ben/PokemonGo-Bot/local/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen return opener.open(url, data, timeout) File "/home/ben/PokemonGo-Bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open response = self._open(req, data) File "/home/ben/PokemonGo-Bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open '_open', req) File "/home/ben/PokemonGo-Bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain result = func(*args) File "/home/ben/PokemonGo-Bot/local/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open return self.do_open(ValidHTTPSConnection, req) File "/home/ben/PokemonGo-Bot/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 "/usr/lib/python2.7/httplib.py", line 1057, in request self._send_request(method, url, body, headers) File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request self.endheaders(body) File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders self._send_output(message_body) File "/usr/lib/python2.7/httplib.py", line 895, in _send_output msg += message_body UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128) 2016-08-08 00:42:11,082 [sentry.errors.uncaught] [ERROR] [u"TypeError: None has type , but expected one of: (, )", u' File "pokecli.py", line 502, in ', u' File "pokecli.py", line 133, in main']

BenjDG avatar Aug 08 '16 06:08 BenjDG

Same here on Archlinux running latest dev branch with google account, kind of weird.

nujabse avatar Aug 08 '16 06:08 nujabse

Same for me. Running dev branch on a raspberry pi2

2016-08-08 07:30:06,781 [MoveToFort] [INFO] [moving_to_lured_fort] Moving towards pokestop NIA Headquarters Amsterdam - 0.07km (attraction of lure 0.50km)
2016-08-08 07:30:19,812 [       cli] [INFO]
2016-08-08 07:30:19,817 [       cli] [INFO] Ran for 1:00:02
2016-08-08 07:30:19,818 [       cli] [INFO] Total XP Earned: 7215  Average: 7210.74/h
2016-08-08 07:30:19,819 [       cli] [INFO] Travelled 0.78km
2016-08-08 07:30:19,820 [       cli] [INFO] Visited 31 stops
2016-08-08 07:30:19,820 [       cli] [INFO] Encountered 25 pokemon, 24 caught, 24 released, 0 evolved, 0 never seen before
2016-08-08 07:30:19,821 [       cli] [INFO] Threw 28 pokeballs
2016-08-08 07:30:19,822 [       cli] [INFO] Earned 3668 Stardust
2016-08-08 07:30:19,822 [       cli] [INFO]
2016-08-08 07:30:19,823 [       cli] [INFO] Highest CP Pokemon: Staryu [CP: 481] [IV: 9/11/15] Potential: 0.78
2016-08-08 07:30:19,823 [       cli] [INFO] Most Perfect Pokemon: Magikarp [CP: 25] [IV: 14/12/10] Potential: 0.8
Traceback (most recent call last):
  File "pokecli.py", line 503, in <module>
    main()
  File "pokecli.py", line 89, in main
    bot.tick()
  File "/home/bjorn/dev/PokemonGo-Bot/pokemongo_bot/__init__.py", line 434, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/home/bjorn/dev/PokemonGo-Bot/pokemongo_bot/cell_workers/evolve_pokemon.py", line 28, in work
    response_dict = self.api.get_inventory()
  File "/home/bjorn/dev/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 122, in function
    return request.call()
  File "/home/bjorn/dev/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 106, in call
    result = self._call()
  File "/home/bjorn/dev/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 63, in _call
    return PGoApiRequest.call(self)
  File "/home/bjorn/dev/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 220, in call
    response = request.request(self._api_endpoint, self._req_method_list, self.get_position())
  File "/home/bjorn/dev/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 126, in request
    request_proto = self._build_main_request(subrequests, player_position)
  File "/home/bjorn/dev/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 216, in _build_main_request
    request.auth_info.token.contents = self._auth_provider.get_access_token()
  File "/home/bjorn/dev/PokemonGo-Bot/local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 669, in field_setter
    new_value = type_checker.CheckValue(new_value)
  File "/home/bjorn/dev/PokemonGo-Bot/local/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 176, in CheckValue
    raise TypeError(message)
TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)

scarfield avatar Aug 08 '16 06:08 scarfield

Related: https://github.com/jabbink/PokemonGoBot/issues/830

omeryagmurlu avatar Aug 08 '16 12:08 omeryagmurlu

same here, crashing after 1 hour of running i've also tried https://github.com/PokemonGoF/PokemonGo-Bot/issues/3075 but it didnt work

noncicredo avatar Aug 09 '16 01:08 noncicredo

Removed and updated pgoapi. 1+ hour running right now. No crash. Will update if it crashes (or not). Update: Total Run time 1h 08m Traceback (most recent call last): File "/usr/lib/python2.7/logging/init.py", line 851, in emit msg = self.format(record) File "/usr/lib/python2.7/logging/init.py", line 724, in format return fmt.format(record) File "/usr/lib/python2.7/logging/init.py", line 464, in format record.message = record.getMessage() File "/usr/lib/python2.7/logging/init.py", line 328, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Logged from file init.py, line 547

Followed by Traceback (most recent call last): File "pokecli.py", line 493, in main() File "pokecli.py", line 129, in main raise e TypeError: None has type <type 'NoneType'>, but expected one of: (<type 'str'>, <type 'unicode'>)

pranavperfect avatar Aug 09 '16 07:08 pranavperfect

Removed and updated pgoapi. 1+ hour running right now. No crash. Will update if it crashes (or not).

How do I update the pgoapi?

15calderm avatar Aug 09 '16 07:08 15calderm