Skip to content

Commit 8c1b3f3

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 b418245 commit 8c1b3f3

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
@@ -112,7 +112,7 @@ def __init__(
112112
else:
113113
# Assume comma separated string of channels
114114
self.channels = [int(ch.strip()) for ch in channel.split(",")]
115-
self._app_name = app_name.encode() if app_name is not None else ""
115+
self._app_name = app_name.encode() if app_name is not None else b""
116116
self.channel_info = "Application %s: %s" % (
117117
app_name,
118118
", ".join("CAN %d" % (ch + 1) for ch in self.channels),

0 commit comments

Comments
 (0)