Skip to content

Commit de72634

Browse files
committed
ptscontrol: Fix AttributeError exception
The restart_pts method can be called without args provided. Fix exception: ... if args.dongle_init_retry == 0: AttributeError: 'NoneType' object has no attribute 'dongle_init_retry'
1 parent 6ef4448 commit de72634

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

autopts/ptscontrol.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ def restart_pts(self, args=None):
513513

514514
log("restart_pts")
515515
exception = 0
516+
dongle_init_retry = getattr(args, "dongle_init_retry", 5)
517+
516518
while not self._end.is_set():
517519
try:
518520
self.stop_pts()
@@ -530,10 +532,10 @@ def restart_pts(self, args=None):
530532
# the only running instance of autoptsserver.py
531533
if count_script_instances('autoptsserver.py') <= 1:
532534
kill_all_processes('PTS.exe')
533-
if args.dongle_init_retry == 0:
535+
if dongle_init_retry == 0:
534536
continue
535537
exception += 1
536-
if exception >= args.dongle_init_retry:
538+
if exception >= dongle_init_retry:
537539
# This stops PTS from restarting indefinitely when PTS
538540
# dongle is unplugged
539541
print("Please check your dongle connection! Aborting")

0 commit comments

Comments
 (0)