pyOCD icon indicating copy to clipboard operation
pyOCD copied to clipboard

Error: 'NoneType' object is not iterable [__main__]

Open buzmeg opened this issue 8 months ago • 0 comments

In tcp_client_probe.py the following code exists:

    _PROPERTY_CONVERTERS = {
            'capabilities':                 lambda value: [DebugProbe.Capability[v] for v in value],
            'supported_wire_protocols':     lambda value: [DebugProbe.Protocol[v] for v in value],
            'wire_protocol':                lambda value: DebugProbe.Protocol[value] if (value is not None) else None,
        }

Presumably, that None shield needs to be present for all of them right?

I'm also more used to seeing something like: for ii in value or [] rather than that if statement, but I don't know if they are precisely equivalent.

Side note: the logging didn't give me a very useful traceback and I had to add a bunch of code to main.py to get a useful traceback. All it gave was the useless: 0000575 C Error: 'NoneType' object is not iterable [__main__]

Full traceback after I added code:

pyOCD % pyocd erase -L pyocd.probe.tcp_client_probe.trace=debug --uid=remote:192.168.13.17:3333 --chip --target stm32g0b1retx
0000401 D Request: {"id": 0, "request": "hello", "arguments": [1]} [tcp_client_probe]
0000420 D decoded_response = {'id': 0, 'status': 0} [tcp_client_probe]
0000420 D Request: {"id": 1, "request": "open"} [tcp_client_probe]
0000437 D decoded_response = {'id': 0, 'status': 0} [tcp_client_probe]
0000437 D Request: {"id": 2, "request": "set_clock", "arguments": [1000000]} [tcp_client_probe]
0000459 D decoded_response = {'id': 0, 'status': 0} [tcp_client_probe]
0000497 D Request: {"id": 3, "request": "lock"} [tcp_client_probe]
0000521 D decoded_response = {'id': 0, 'status': 0} [tcp_client_probe]
0000526 D Request: {"id": 4, "request": "readprop", "arguments": ["capabilities"]} [tcp_client_probe]
0000549 D decoded_response = {'id': 0, 'status': 0} [tcp_client_probe]
0000549 D Request: {"id": 5, "request": "disconnect"} [tcp_client_probe]
0000567 D decoded_response = {'id': 0, 'status': 0} [tcp_client_probe]
0000568 D Request: {"id": 6, "request": "close"} [tcp_client_probe]
0000585 D decoded_response = {'id': 0, 'status': 0} [tcp_client_probe]
0000585 C FAULT 2! [__main__]
0000586 C Error: 'NoneType' object is not iterable [__main__]
Traceback (most recent call last):
  File "/var/home/foo/stdev/pyOCD/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
  File "/var/home/foo/stdev/pyOCD/pyocd/subcommands/erase_cmd.py", line 94, in invoke
    with session:
         ^^^^^^^
  File "/var/home/foo/stdev/pyOCD/pyocd/core/session.py", line 415, in __enter__
    self.open()
    ~~~~~~~~~^^
  File "/var/home/foo/stdev/pyOCD/pyocd/core/session.py", line 553, in open
    self._board.init()
    ~~~~~~~~~~~~~~~~^^
  File "/var/home/foo/stdev/pyOCD/pyocd/board/board.py", line 143, in init
    self.target.init()
    ~~~~~~~~~~~~~~~~^^
  File "/var/home/foo/stdev/pyOCD/pyocd/coresight/coresight_target.py", line 123, in init
    super().init()
    ~~~~~~~~~~~~^^
  File "/var/home/foo/stdev/pyOCD/pyocd/core/soc_target.py", line 174, in init
    seq.invoke()
    ~~~~~~~~~~^^
  File "/var/home/foo/stdev/pyOCD/pyocd/utility/sequencer.py", line 213, in invoke
    resultSequence.invoke()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/var/home/foo/stdev/pyOCD/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
  File "/var/home/foo/stdev/pyOCD/pyocd/coresight/dap.py", line 435, in _get_probe_capabilities
    caps = self._probe.capabilities
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/foo/stdev/pyOCD/pyocd/probe/tcp_client_probe.py", line 141, in capabilities
    return self._read_property('capabilities')
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/var/home/foo/stdev/pyOCD/pyocd/probe/tcp_client_probe.py", line 217, in _read_property
    result = self._PROPERTY_CONVERTERS[name](result)
  File "/var/home/foo/stdev/pyOCD/pyocd/probe/tcp_client_probe.py", line 207, in <lambda>
    'capabilities':                 lambda value: [DebugProbe.Capability[v] for v in value],
                                                                                     ^^^^^
TypeError: 'NoneType' object is not iterable

> /var/home/foo/stdev/pyOCD/pyocd/probe/tcp_client_probe.py(207)<lambda>()
-> 'capabilities':                 lambda value: [DebugProbe.Capability[v] for v in value],
(Pdb)

buzmeg avatar May 06 '25 05:05 buzmeg