Skip to content

invalid literal for int() with base 16: ',0' #71

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

Closed
jingyq1 opened this issue Dec 3, 2019 · 2 comments
Closed

invalid literal for int() with base 16: ',0' #71

jingyq1 opened this issue Dec 3, 2019 · 2 comments

Comments

@jingyq1
Copy link

jingyq1 commented Dec 3, 2019

when I tried to run tutorials file "ready_to_localize.py", it cannot continuously repeat the loop.
File "/home/alpha/anaconda2/envs/pypa3/lib/python3.5/site-packages/pypozyx-1.3.0-py3.5.egg/pypozyx/structures/byte_structure.py", line 33, in bytes_to_data
ValueError: invalid literal for int() with base 16: ',0'
I think this bug is caused by unpack problem
Is there any way to solve that?

python 3.6
pypozyx

@AndreasAntener
Copy link

I encounter similar issues:

  File "/usr/local/lib/python3.9/site-packages/pypozyx-1.3.0-py3.9.egg/pypozyx/lib.py", line 1089, in doPositioning
    status = self.doPositioningWithData(position_data, remote_id=remote_id, timeout=timeout)
  File "/usr/local/lib/python3.9/site-packages/pypozyx-1.3.0-py3.9.egg/pypozyx/lib.py", line 1143, in doPositioningWithData
    return self.getPositioningData(positioning_data)
  File "/usr/local/lib/python3.9/site-packages/pypozyx-1.3.0-py3.9.egg/pypozyx/lib.py", line 1129, in getPositioningData
    positioning_data.load_bytes(r[2:])
  File "/usr/local/lib/python3.9/site-packages/pypozyx-1.3.0-py3.9.egg/pypozyx/structures/sensor_data.py", line 462, in load_bytes
    self.bytes_to_data()
  File "/usr/local/lib/python3.9/site-packages/pypozyx-1.3.0-py3.9.egg/pypozyx/structures/byte_structure.py", line 34, in bytes_to_data
    self.load_packed(s)
  File "/usr/local/lib/python3.9/site-packages/pypozyx-1.3.0-py3.9.egg/pypozyx/structures/byte_structure.py", line 42, in load_packed
    self.data[i] = struct.unpack(self.data_format[i], packed[
struct.error: unpack requires a buffer of 4 bytes

There is defeinitely something off with the parsing, maybe related to bad data. But it's not handled by the library. These errors pop up every 100 doPositioning calls for me.

For a working application, the library calls for ranging or positioning need to be in a try/catch block.

@laurentva
Copy link
Collaborator

Hey Andreas, we're going to follow this up via the support mail. For others that encounter this issue: please make a new issue and include the Pozyx code you're using.

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