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

TypeError: Odd-length string #187

Open
scottie opened this issue Aug 7, 2016 · 4 comments
Open

TypeError: Odd-length string #187

scottie opened this issue Aug 7, 2016 · 4 comments

Comments

@scottie
Copy link

scottie commented Aug 7, 2016

output = binascii.a2b_hex(input)
TypeError: Odd-length string

2016-08-07 05:15:37,739 [    pgoapi] [ INFO] pgoapi v1.1.7 - Copyright (c) 2016 tjado <https://github.com/tejado>
2016-08-07 05:15:38,059 [ utilities] [ INFO] Location for 'Nimbin' found: Nimbin NSW 2480, Australia
2016-08-07 05:15:38,059 [ utilities] [ INFO] Coordinates (lat/long/alt) for location: -28.595833 153.223056 0.0
2016-08-07 05:15:38,061 [  auth_ptc] [ INFO] PTC User Login for: kDPDjkFzVKGg
2016-08-07 05:15:39,967 [  auth_ptc] [ INFO] PTC User Login successful.
2016-08-07 05:15:39,967 [  auth_ptc] [ INFO] Request PTC Access Token...
2016-08-07 05:15:40,429 [  auth_ptc] [ INFO] PTC Access Token successfully retrieved.
2016-08-07 05:15:40,445 [    pgoapi] [ INFO] Creating a new direct request...
2016-08-07 05:15:40,445 [    pgoapi] [ INFO] Adding 'GET_MAP_OBJECTS' to RPC request including arguments
2016-08-07 05:15:40,447 [    pgoapi] [ INFO] Execution of RPC
2016-08-07 05:15:41,052 [    pgoapi] [ INFO] API Endpoint redirect... re-execution of call
Traceback (most recent call last):
  File "pokecli.py", line 133, in <module>
    main()
  File "pokecli.py", line 128, in main
    response_dict = api.get_map_objects(latitude =position[0], longitude = position[1], since_timestamp_ms = timestamps, cell_id = cell_ids
) 
  File "/root/pgoapi/pgoapi/pgoapi.py", line 121, in function
    return request.call()
  File "/root/pgoapi/pgoapi/pgoapi.py", line 219, in call
    response = request.request(self._api_endpoint, self._req_method_list, self.get_position())
  File "/root/pgoapi/pgoapi/rpc_api.py", line 125, in request
    request_proto = self._build_main_request(subrequests, player_position)
  File "/root/pgoapi/pgoapi/rpc_api.py", line 196, in _build_main_request
    sig.location_hash1 = generateLocation1(ticket_serialized, request.latitude, request.longitude, request.altitude)
  File "/root/pgoapi/pgoapi/utilities.py", line 165, in generateLocation1
    locationBytes = d2h(lat) + d2h(lng) + d2h(alt)
  File "/root/pgoapi/pgoapi/utilities.py", line 183, in d2h
    return hex(struct.unpack('<Q', struct.pack('<d', f))[0])[2:-1].decode("hex")
  File "/usr/lib/python2.7/encodings/hex_codec.py", line 42, in hex_decode
    output = binascii.a2b_hex(input)
TypeError: Odd-length string
@ProLoDs
Copy link

ProLoDs commented Aug 7, 2016

same here, what python version are you using?
My guess would be the python version.
working with 2.7.11
error with 2.7.9

@mviniciusleal
Copy link

same error on 2.7.12

@ProLoDs
Copy link

ProLoDs commented Aug 7, 2016

use python3, worked for me. (just a workaround)

@elliottcarlson
Copy link
Contributor

elliottcarlson commented Aug 7, 2016

This is fixed in the new repo which will be merged in here at some point.

See https://github.com/keyphact/pgoapi/pull/9/files for solution.

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

4 participants