Skip to content

Commit 5d864dd

Browse files
Missed changes related to hardbyte#132
1 parent 6ead863 commit 5d864dd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

can/interfaces/nican.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def get_error_message(status_code):
8282
try:
8383
nican = ctypes.windll.LoadLibrary("nican")
8484
except Exception as e:
85+
nican = None
8586
logger.error("Failed to load NI-CAN driver: %s", e)
8687
else:
8788
nican.ncConfig.argtypes = [
@@ -128,6 +129,10 @@ def __init__(self, channel, can_filters=None, bitrate=None, log_errors=True,
128129
:raises can.interfaces.nican.NicanError:
129130
If starting communication fails
130131
"""
132+
if nican is None:
133+
raise ImportError("The NI-CAN driver could not be loaded. "
134+
"Check that you are using 32-bit Python on Windows.")
135+
131136
self.channel_info = "NI-CAN: " + channel
132137
if not isinstance(channel, bytes):
133138
channel = channel.encode()

0 commit comments

Comments
 (0)