flash_can: report missing pyserial

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan committed 2022-06-08 08:24:53 -04:00
1 parent cf62ff7a8d
commit 446ff1794b
1 file changed
+7 -1
+7 -1
View File
@@ -520,7 +520,13 @@ class SerialSocket:
async def run(self, intf: str, baud: int, fw_path: pathlib.Path) -> None:
if not fw_path.is_file():
raise FlashCanError("Invalid firmware path '%s'" % (fw_path))
import serial
try:
import serial
except ModuleNotFoundError:
raise FlashCanError(
"The pyserial python package was not found. To install "
"run the following command in a terminal: \n\n"
" pip3 install pyserial\n\n")
self.serial_error = serial.SerialException
try:
serial_dev = serial.Serial(baudrate=baud, timeout=0,