这是indexloc提供的服务,不要输入任何密码
Skip to content

KeyError: 'decoded' in DecodeTagMultiple #234

@andyvan-trabus

Description

@andyvan-trabus

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']}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions