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

KeyError: 'decoded' in DecodeTagMultiple #234

Open
andyvan-trabus opened this issue Sep 23, 2021 · 1 comment
Open

KeyError: 'decoded' in DecodeTagMultiple #234

andyvan-trabus opened this issue Sep 23, 2021 · 1 comment

Comments

@andyvan-trabus
Copy link
Contributor

I saw the following exception:

python3 test_234.py
Traceback (most recent call last):
File "test_234.py", line 9, in
queue.put(line, line_no)
File "/home/avanpelt/git/TMP/FORK/libais-fork/ais/tag_block.py", line 171, in put
decoded = DecodeTagMultiple(entry)
File "/home/avanpelt/git/TMP/FORK/libais-fork/ais/tag_block.py", line 225, in DecodeTagMultiple
return msg['decoded']
KeyError: 'decoded'

Here are the lines exactly as they were in the original test file:

10/07/19 17:36:42:075 \s:49\g:1-2-11262,n:235196,s:r17MDUT1,c:157046979849!AIVDM,2,1,9,A,55Na3b400001L@W;3GTu84<hF22000000000000N0p:,078
10/07/19 17:36:42:075 \s:49\g:2-2-11262,n:23519718!AIVDM,2,2,9,A,44t0Ht:000000000000000000000,,0
41

Here's my test code:

from ais import tag_block

TEST_MESSAGES = ['10/07/19 17:36:42:075 \s:49\g:1-2-11262,n:235196,s:r17MDUT1,c:157046979849\!AIVDM,2,1,9,A,55Na3b400001L@W;3GTu84<hF22000000000000N0p:,078',
'10/07/19 17:36:42:075 \s:49\g:2-2-11262,n:23519718\!AIVDM,2,2,9,A,44t0Ht:000000000000000000000,,0
41']

queue = tag_block.TagQueue()

for line_no, line in enumerate(TEST_MESSAGES):
queue.put(line, line_no)

msgs = []
while not queue.empty():
msgs.append(queue.get())

Here's what msg was:
{'line_nums': [2], 'lines': ['!AIVDM,2,2,9,A,44t0Ht:000000000000000000000,,0*41']}

@andyvan-trabus
Copy link
Contributor Author

I just realized that the quote tag didn't exactly preserve things, so here's the test code again, but with the code tag:

from ais import tag_block

TEST_MESSAGES = ['10/07/19 17:36:42:075 \\s:*49\\g:1-2-11262,n:235196,s:r17MDUT1,c:1570469798*49\\!AIVDM,2,1,9,A,55Na3b400001L@W;3GTu84<hF22000000000000N0p:,0*78',
                 '10/07/19 17:36:42:075 \\s:*49\\g:2-2-11262,n:235197*18\\!AIVDM,2,2,9,A,44t0Ht:000000000000000000000,,0*41']

queue = tag_block.TagQueue()

for line_no, line in enumerate(TEST_MESSAGES):
    queue.put(line, line_no)

msgs = []
while not queue.empty():
    msgs.append(queue.get())

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

1 participant