-
Notifications
You must be signed in to change notification settings - Fork 644
Open
Labels
Description
Describe the bug
I'm attempting to read a configuration from %APPDATA%\can.ini
, specifically this config from the documentation for the PCAN Basic API:
[default]
interface = pcan
channel = PCAN_USBBUS1
state = can.bus.BusState.PASSIVE
bitrate = 500000
Rather than interpret the state config as an enum value, python-can
seems to treat it as a string, so fails with:
ValueError: BusState must be Active or Passive
To Reproduce
Try to instantiate can.Bus()
with the above config in %APPDATA%\can.ini
.
Expected behavior
state = can.bus.BusState.PASSIVE
is interpreted as the enum value rather than the string 'can.bus.BusState.PASSIVE'.
Additional context
OS and version: Windows 11 Pro 24H2
Python version: 3.13.4
python-can version: 4.5.0
python-can interface/s (if applicable): PCAN Basic API