-
Notifications
You must be signed in to change notification settings - Fork 655
Description
Describe the bug
I can't connect with my PEAK-USB dongle when in my 32 bit environment, there is no issue when using 64 bit environment.
I get OSError: The PEAK-driver could not be found!
There is no issues with Kvaser, Vector, IXXAT or Iscan.
To Reproduce
Python-can is used through canopen for python (https://github.com/christiansandberg/canopen)
Using 32 bits python just trying to do a connect.
Additional context
The issue seems to be that the check to look for the driver fails even though it exists. If check is ignored it successfully loads the driver. It fails on "with winreg.OpenKey(reg, r"SOFTWARE\PEAK-System\PEAK-Drivers"):" If raise OSError is replaced with "pass" it will successfully load the driver.
if platform.system() == "Windows":
load_library_func = windll.LoadLibrary
# look for Peak drivers in Windows registry
with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as reg:
try:
with winreg.OpenKey(reg, r"SOFTWARE\PEAK-System\PEAK-Drivers"):
pass
except OSError:
raise OSError("The PEAK-driver could not be found!") from None
else:
load_library_func = cdll.LoadLibraryOS and version: Windows 11 Pro Version:22H2 OS build: 22621.1992
Python version: 3.7.9-32
python-can version: 4.2.2
python-can interface/s (if applicable): PEAK-Drivers 4.4.0.556
Traceback and logs
File "C:\MyTool \interface\canopen\network.py", line 109, in connect
self.bus = can.interface.Bus(*args, **kwargs)
File "c:\MyTool\python\lib\site-packages\can\util.py", line 369, in wrapper
return f(*args, **kwargs)
File "c:\MyTool\python\lib\site-packages\can\interface.py", line 138, in new
bus = cls(channel, **kwargs)
File "c:\MyTool\python\lib\site-packages\can\interfaces\pcan\pcan.py", line 238, in init
self.m_objPCANBasic = PCANBasic()
File "c:\MyTool\python\lib\site-packages\can\interfaces\pcan\basic.py", line 688, in init
raise OSError("The PEAK-driver could not be found!") from None
OSError: The PEAK-driver could not be found!