semuconsulting / pyubx2

Python library for parsing and generating UBX GPS/GNSS protocol messages.
BSD 3-Clause "New" or "Revised" License
173 stars 66 forks source link

pyubx2 stop processing when there is a broken data in the ubx file. #109

Closed yang-neu closed 1 year ago

yang-neu commented 1 year ago

May I ask for your assistance with regard to an issue I am encountering? It appears that when there is broken data in the UBX file, the program Pyubx2 raises an exception and stops processing. The error message associated with this exception is "'str' object has no attribute 'dict'". I have noticed that this issue persists even with the latest version 1.2.23.

I kindly request your help in addressing this issue. Would it be possible to continue the procedure despite the error data by simply displaying some messages? For your information, my operating system is Windows 10 and I am recording logs via U-center v22.05. The device model I am using is the u-blox NEO-9M, and the protocol in use is UBX_PROTOCOL.

Thank you for your attention to this matter. I sincerely appreciate any response or assistance you can provide.

semuadmin commented 1 year ago

HI @yang-neu

Please provide a copy of the script you're running, the FULL TRACEBACK of the error message you're getting and, if possible, a copy of the UBX file you're trying to process. Thank you.

FYI by default, pyubx2's UBXReader should ignore errors in any incoming UBX data stream and continue. This behaviour is governed by the quitonerror keyword argument:

quitonerror - 0 = ignore errors, 1 = log errors and continue, 2 = (re)raise errors (default = 1)

FYI by default, u-center 2 includes proprietary debug and device configuration (CFG-VALGET) UBX data in its log file. As of version 1.2.15, pyubx2 is able to read this debug and configuration data, but it can only parse either input or output data in the same data stream - this is governed by the msgmode keyword argument:

msgmode - 0 = input (i.e. data from the receiver) 1 = output (i.e. data to the receiver) (default=0)

Try disabling the 'Enable all debug messages' and 'Add device configuration' options when recording a log file in u-center 2 and see if pyubx2 is then able to read the file OK.

yang-neu commented 1 year ago

Hi @semuadmin

Much appreciated.

I debugged my code again, the exception happened on parsing JSON data from "gnssdump" when the ubx included some error data. I have ignored these exceptions.

semuadmin commented 1 year ago

No worries. More than happy to consider any enhancements that may make life easier.