-for line in f:
- if errorflg :
- break
- # strip comments
- if line.startswith(';') :
- continue
- l= line.strip()
- s.write(l + '\n')
- linecnt+=1
- if verbose: print("SND " + str(linecnt) + ": " + line.strip() + " - " + str(okcnt))
-
+try:
+ for line in f:
+ if errorflg :
+ break
+ # strip comments
+ if line.startswith(';') :
+ continue
+ l= line.strip()
+ s.write(l + '\n')
+ linecnt+=1
+ if verbose: print("SND " + str(linecnt) + ": " + line.strip() + " - " + str(okcnt))
+
+except KeyboardInterrupt:
+ print("Interrupted...")
+ intrflg= True
+
+if intrflg :
+ # We need to consume oks otherwise smoothie will deadlock on a full tx buffer
+ print("Sending Abort - this may take a while...")
+ s.write('\x18') # send halt
+