Commit c5963dae authored by Gary Hodgson's avatar Gary Hodgson Committed by Guillaume Seguin

more info for serial exceptions

Conflicts:
	printcore.py
parent 267b9db2
...@@ -167,17 +167,18 @@ class printcore(): ...@@ -167,17 +167,18 @@ class printcore():
except: pass except: pass
if self.loud: print "RECV: ", line.rstrip() if self.loud: print "RECV: ", line.rstrip()
return line return line
except SelectError, e: except SelectError as e:
if 'Bad file descriptor' in e.args[1]: if 'Bad file descriptor' in e.args[1]:
print "Can't read from printer (disconnected?)." print "Can't read from printer (disconnected?) ({0}): {1}".format(e.errno, e.strerror)
return None return None
else: else:
print "SelectError ({0}): {1}".format(e.errno, e.strerror)
raise raise
except SerialException, e: except SerialException as e:
print "Can't read from printer (disconnected?)." print "Can't read from printer (disconnected?) ({0}): {1}".format(e.errno, e.strerror)
return None return None
except OSError, e: except OSError as e:
print "Can't read from printer (disconnected?)." print "Can't read from printer (disconnected?) ({0}): {1}".format(e.errno, e.strerror)
return None return None
def _listen_can_continue(self): def _listen_can_continue(self):
...@@ -476,9 +477,9 @@ class printcore(): ...@@ -476,9 +477,9 @@ class printcore():
self.printer.write(str(command + "\n")) self.printer.write(str(command + "\n"))
self.printer.flush() self.printer.flush()
except SerialException, e: except SerialException, e:
print "Can't write to printer (disconnected?)." print "Can't write to printer (disconnected?) ({0}): {1}".format(e.errno, e.strerror)
except RuntimeError, e: except RuntimeError, e:
print "Socket connection broken, disconnected." print "Socket connection broken, disconnected. ({0}): {1}".format(e.errno, e.strerror)
if __name__ == '__main__': if __name__ == '__main__':
baud = 115200 baud = 115200
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment