From f139756fba4c0cb425185252f4829476e66f08e0 Mon Sep 17 00:00:00 2001 From: Karl Date: Sun, 19 Apr 2020 00:30:15 -0700 Subject: [PATCH] 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 --- can/interfaces/vector/canlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/can/interfaces/vector/canlib.py b/can/interfaces/vector/canlib.py index 14205327b..ac85ef4ce 100644 --- a/can/interfaces/vector/canlib.py +++ b/can/interfaces/vector/canlib.py @@ -112,7 +112,7 @@ def __init__( else: # Assume comma separated string of channels self.channels = [int(ch.strip()) for ch in channel.split(",")] - self._app_name = app_name.encode() if app_name is not None else "" + self._app_name = app_name.encode() if app_name is not None else b"" self.channel_info = "Application %s: %s" % ( app_name, ", ".join("CAN %d" % (ch + 1) for ch in self.channels),