Skip to content

BlockDownloadStream class in sdo\client.py appears to be missing an object definition #624

Description

@Eqqm4n

Hello-
In sdo\client.py the BlockDownloadStream class refers to the self.crc_supported attribute on lines 680, 738, and 812, but this class attribute does not appear to be defined (and as a side note, the BlockUploadStream class does define one).

I ran across this issue when a host's block transfer request was rejected by the device, causing the library to go down one of these broken code paths:

2026-01-05 14:42:37,387 - canopen_client - ERROR - Full traceback:
Traceback (most recent call last):
  File "C:\nVent_work\zephyr_root\zephyr_repo\nvent_projects\canopen_sim\canopen_sim\canopen_client.py", line 724, in upload_firmware
    with self.node.sdo.open(index, subindex, "wb",
         ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
                          size=total_size,
                          ^^^^^^^^^^^^^^^^
                          block_transfer=True) as fp:
                          ^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python313\Lib\site-packages\canopen\sdo\client.py", line 213, in open
    raw_stream = BlockDownloadStream(self, index, subindex, size, request_crc_support=request_crc_support)
  File "C:\Program Files\Python313\Lib\site-packages\canopen\sdo\client.py", line 655, in __init__
    response = sdo_client.request_response(request)
  File "C:\Program Files\Python313\Lib\site-packages\canopen\sdo\client.py", line 86, in request_response
    return self.read_response()
           ~~~~~~~~~~~~~~~~~~^^
  File "C:\Program Files\Python313\Lib\site-packages\canopen\sdo\client.py", line 74, in read_response
    raise SdoAbortedError(abort_code)
canopen.sdo.exceptions.SdoAbortedError: Code 0x05040001, Unknown SDO command specified
2026-01-05 14:42:37,391 - canopen_client - ERROR - Error uploading firmware: Code 0x05040001, Unknown SDO command specified
Exception ignored in: <canopen.sdo.client.BlockDownloadStream object at 0x000001F2DDEF6A40>
Traceback (most recent call last):
  File "C:\Program Files\Python313\Lib\site-packages\canopen\sdo\client.py", line 793, in close
    if self.crc_supported:
AttributeError: 'BlockDownloadStream' object has no attribute 'crc_supported'
2026-01-05 14:42:38,548 - canopen_client - INFO - Disconnected from CAN bus

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions