Python, Exception in the decoding.csv

42 views
Skip to first unread message

Ruan Ainslie

unread,
Feb 18, 2022, 7:21:23 AM2/18/22
to Plus Codes Community Forum
Good day everyone.

Could anyone please help me resolve the following exception?

When I run the openlocationcode_test.py script, I get the following Exception:

Exception has occurred: AssertionError (note: full exception trace is shown but execution is paused at: test_decoding)
2.7822363281 != 2.782236328 : {'code': '7FG49QCJ+2VXGJ', 'length': 13.0, 'latLo': 20.370113, 'lngLo': 2.782234375, 'latHi': 20.370114, 'longHi': 2.782236328}

This is my first time using Open-Location-Code, and I do not know how to resolve this (ps. I have been sitting with this exception for the past 2 Hours, and have tried everything I can think of).

Andreas B

unread,
Feb 18, 2022, 8:05:47 AM2/18/22
to Plus Codes Community Forum
Hi,

this seems to be caused by a rounding error - I'm not exactly sure which part is to blame, but this line defines a precision of 10 for all values to be tested, while this test case has values all over the place, ranging from six to eleven digits after the decimal point.

If you are just trying to use plus codes, it is probably safe to just remove that ultra-exact test case for the time being. If you want to contribute code, it might be worth checking out why this test fails for you but apparently not on GitHub - I'm not a Python expert, so can't really help with that part. :)
Reply all
Reply to author
Forward
0 new messages