Skip to content

Commit 7c4c3a0

Browse files
committed
Handle port open exception
Signed-off-by: Ajay Bhargav <[email protected]>
1 parent a8fa4a9 commit 7c4c3a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

siwiflasher.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import os.path
5151
from os.path import join
5252
from serial import Serial
53+
import serial.serialutil as serialutil
5354
from binascii import hexlify
5455
import inspect
5556

@@ -436,7 +437,10 @@ def uploadApplication(self, id, filename, check=True):
436437

437438

438439
def upload_app(file_name, com_port, baud=460800, module="siwigsm"):
439-
m = MT6261(Serial(com_port, 115200))
440+
try:
441+
m = MT6261(Serial(com_port, 115200))
442+
except serialutil.SerialException as ex:
443+
ERROR(ex)
440444
m.connect()
441445
m.da_start()
442446
m.da_changebaud(baud)

0 commit comments

Comments
 (0)