From 34204899e61bcc97cc26617e03d0bbae075dbb0e Mon Sep 17 00:00:00 2001 From: kliment Date: Tue, 24 May 2011 10:21:10 +0200 Subject: [PATCH] Disconnect after upload is done --- blupload.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/blupload.py b/blupload.py index dc88c3b..77dc450 100644 --- a/blupload.py +++ b/blupload.py @@ -14,7 +14,13 @@ def blupload(printer,filename,path): sys.stdout.write("\b\b\b\b%02.1f%%" % (100*float(printer.queueindex)/len(printer.mainqueue),) ) sys.stdout.flush() printer.send_now("M29 "+dosify(filename)) + print "Done uploading, disconnecting with a 5 second timeout in case the printer has something important to say." + printer.disconnect() + time.sleep(5) + print "Upload complete. Goodbye!" + except: + print "Abort, disconnecting with a 5 second timeout in case the printer has something important to say." printer.disconnect() if __name__ == '__main__': @@ -29,6 +35,7 @@ if __name__ == '__main__': p.loud=True time.sleep(2) blupload(p,tfilename,filename) + else: print "Usage: python blupload.py filename.gcode"