elupus/irgen

Exception when parsing broadlink_base64

Closed this issue · 8 comments

First of all, thanks for providing this tool. I am trying to convert broadlink base64 into pronto.

When I use the example from your documentation:

irgen -i broadlink_base64 -d JgAaAB0dOjo6HR0dHR0dHR0dHR0dHR0dHTodAAtnDQUAAAAAAAAAAAAAAAA= -o pronto

I get the following traceback. I've installed this via pip3 install irgen.

Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/irgen/init.py", line 222, in decode_iter
d = next(x)
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/bin/irgen", line 10, in
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/irgen/console.py", line 136, in main
print(" ".join(irgen.gen_pronto_from_raw([], code['raw'], base=0x73)))
File "/usr/local/lib/python3.7/site-packages/irgen/init.py", line 304, in gen_pronto_from_raw
for value in data:
File "/usr/local/lib/python3.7/site-packages/irgen/init.py", line 290, in gen_pronto_from_raw_int
simple2 = fixup(seq2)
File "/usr/local/lib/python3.7/site-packages/irgen/init.py", line 286, in fixup
return list(gen_paired_from_raw(gen_simplified_from_raw(x)))
File "/usr/local/lib/python3.7/site-packages/irgen/init.py", line 197, in gen_paired_from_raw
for i in x:
File "/usr/local/lib/python3.7/site-packages/irgen/init.py", line 175, in gen_simplified_from_raw
for i in x:
File "/usr/local/lib/python3.7/site-packages/irgen/init.py", line 233, in gen_raw_from_broadlink_base64
yield from gen_raw_from_broadlink(b64decode(data))
File "/usr/local/lib/python3.7/site-packages/irgen/init.py", line 229, in gen_raw_from_broadlink
yield from decode_iter(islice(v, length))
RuntimeError: generator raised StopIteration

Could you try and quote the base64 string? The trailing = sign might be wrongly handled by argument parser.

That was my first guess as well, but that doesn't make any difference. I also tried running under different shells, but again no difference.

I am running Python 3.7.4 on MacOS...

The data seem to be short. Byte 3 and 4 of the decoded base 64 data is length of data. It seem to say it should be 416 bytes long.

Where did you get the string?

Oh. Is that from my example. Weird.

Doesn’t work with the ones I got from the remote either

i experience the same problem

Will try to get some time to look at it.

Should be fixed. published new version to pypi