bcm-cfedump icon indicating copy to clipboard operation
bcm-cfedump copied to clipboard

TypeError: '<' not supported between instances of 'int' and 'bytes'

Open danitool opened this issue 5 years ago • 10 comments

Tested with python3.8, it throws this error:

[dani@tool bcm-cfedump]$ python -m bcm_cfedump -D /dev/ttyUSB0 -O nand.img -t 0.02 nand

Waiting for a prompt...

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/bcm-cfedump/bcm-cfedump/bcm_cfedump.py", line 477, in <module>
    main()
  File "/bcm-cfedump/bcm-cfedump/bcm_cfedump.py", line 457, in main
    c.wait_for_prompt()
  File "/bcm-cfedump/bcm-cfedump/bcm_cfedump.py", line 328, in wait_for_prompt
    self._read(b"\r\n")
  File "/bcm-cfedump/bcm_cfedump.py", line 314, in _read
    return self.ser.read(*a, **kw)
  File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 481, in read
    while len(read) < size:
TypeError: '<' not supported between instances of 'int' and 'bytes'
[dani@tool bcm-cfedump]$ 

However the commit 6d61613a175b229e11fb20eddfbe4480c337cbb7 works ok

danitool avatar Jan 10 '20 18:01 danitool

Hi, it looks like the serial library changed their API https://github.com/Depau/bcm-cfedump/blob/master/bcm_cfedump.py#L328

I can't test it, if you can send a pull request it would be great.

depau avatar Jan 11 '20 02:01 depau

What version of pyserial did you use when this was written? I'm hoping a quick fix would be to use that version instead.

gclair avatar Oct 12 '20 02:10 gclair

What version of pyserial did you use when this was written? I'm hoping a quick fix would be to use that version instead.

try my commits in my forked branch. tested with ASUS AC86U in CFE console (MX30LF2G18AC 256MB flash). i'll make a PR later.

my python version: 3.6 pyserial version: latest release (for this moment 2020/11/18)

use "nand" command to dump memory, the nand_bulk still has problem it can't work correctly.

ps. Dumpping over serial console is really slow. It took 37hr for a 256MB nand flash in 1.2Bytes/s avg speed with 115200 bps baudrate

hpo14 avatar Nov 20 '20 05:11 hpo14

Hi!

I've got python 3.9 & pyserial 3.4 and get the same error:

`$ python3 bcm_cfedump.py -D /dev/ttyUSB0 -O nand.bin -t 0.01 nand

Waiting for a prompt...

Traceback (most recent call last): File "/home/.../Routers/bcm-cfedump-master/bcm_cfedump.py", line 478, in main() File "/home/.../Routers/bcm-cfedump-master/bcm_cfedump.py", line 458, in main c.wait_for_prompt() File "/home/.../Routers/bcm-cfedump-master/bcm_cfedump.py", line 329, in wait_for_prompt self._read(b"\r\n") File "/home/.../Routers/bcm-cfedump-master/bcm_cfedump.py", line 315, in _read return self.ser.read(*a, **kw) File "/home/../.local/lib/python3.9/site-packages/serial/serialposix.py", line 563, in read while len(read) < size: TypeError: '<' not supported between instances of 'int' and 'bytes' ` ... and i'm trying to follow this conversation of yours to try to solve my issue https://github.com/Depau/bcm-cfedump/pull/3 .

Am I on the right track?

Tulainas avatar Mar 18 '21 22:03 Tulainas

I already said

I can't test it, if you can send a pull request it would be great

depau avatar Mar 19 '21 12:03 depau

Ok, let me try it. Be patient. Dummy here.

I've forked the repository into my account, and, well... where to go from here? I haven't made any change at all to compare with. If I ask for a PR from my fork it says we're obviously even.

Tulainas avatar Mar 24 '21 03:03 Tulainas

What version of pyserial did you use when this was written? I'm hoping a quick fix would be to use that version instead.

try my commits in my forked branch. tested with ASUS AC86U in CFE console (MX30LF2G18AC 256MB flash). i'll make a PR later.

my python version: 3.6 pyserial version: latest release (for this moment 2020/11/18)

use "nand" command to dump memory, the nand_bulk still has problem it can't work correctly.

ps. Dumpping over serial console is really slow. It took 37hr for a 256MB nand flash in 1.2Bytes/s avg speed with 115200 bps baudrate

Already created a virtual environment with python36 and current pyserial version 3.5 and no dice. Same error.

Let me keep trying.

Tulainas avatar Mar 28 '21 21:03 Tulainas

What version of pyserial did you use when this was written? I'm hoping a quick fix would be to use that version instead.

try my commits in my forked branch. tested with ASUS AC86U in CFE console (MX30LF2G18AC 256MB flash). i'll make a PR later. my python version: 3.6 pyserial version: latest release (for this moment 2020/11/18) use "nand" command to dump memory, the nand_bulk still has problem it can't work correctly. ps. Dumpping over serial console is really slow. It took 37hr for a 256MB nand flash in 1.2Bytes/s avg speed with 115200 bps baudrate

Already created a virtual environment with python36 and current pyserial version 3.5 and no dice. Same error.

Let me keep trying.

Does the pull request i made not working for u ? https://github.com/Depau/bcm-cfedump/pull/3

hpo14 avatar Mar 31 '21 16:03 hpo14

Please lmk if merging #3 fixes it.

depau avatar Mar 31 '21 17:03 depau

I hadn't tried it... what was I thinking?

I just did. It does solve the "int and bytes" issue... but i'm not sure this is the result we are expecting:

=== terminal: $ python ./bcm-cfedump-master-hpo14/bcm-cfedump-master/bcm_cfedump.py -D /dev/ttyUSB0 -O nand.img -t 0.01 nand

Waiting for a prompt...

Error caused by line: '**Exception 32: EPC=80A4BB28, Cause=0000801C (BusErrWr )' Block 0 page 0 read failed, retrying.

Traceback (most recent call last): File "./bcm-cfedump-master-hpo14/bcm-cfedump-master/bcm_cfedump.py", line 280, in read_pages yield self.read_page(block, page) File "./bcm-cfedump-master-hpo14/bcm-cfedump-master/bcm_cfedump.py", line 261, in read_page addr, buf_temp = parse_serial_line(line.decode()) File "./bcm-cfedump-master-hpo14/bcm-cfedump-master/bcm_cfedump.py", line 30, in parse_serial_line addr = int(m.group('addr'), 16) AttributeError: 'NoneType' object has no attribute 'group'

=== end terminal

Those last three 'File' lines repeat themselves eight times, and there are no output files.

Tulainas avatar Apr 01 '21 02:04 Tulainas