Skip to content

Commit e45c8cc

Browse files
karldinghardbyte
authored andcommitted
Fix Vector CANlib treatment of empty app name
In Python 2, the str type was used for text and bytes, whereas in Python 3, these are separate and incompatible types. This broke instantiation of a VectorBus when the app_name parameter in __init__ was set to None. This correctly sets it to a bytes object. Fixes #796
1 parent 6041bbc commit e45c8cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

can/interfaces/vector/canlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __init__(self, channel, can_filters=None, poll_interval=0.01,
8787
else:
8888
# Assume comma separated string of channels
8989
self.channels = [int(ch.strip()) for ch in channel.split(',')]
90-
self._app_name = app_name.encode() if app_name is not None else ''
90+
self._app_name = app_name.encode() if app_name is not None else b''
9191
self.channel_info = 'Application %s: %s' % (
9292
app_name, ', '.join('CAN %d' % (ch + 1) for ch in self.channels))
9393

0 commit comments

Comments
 (0)