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():
except: pass
if self.loud: print "RECV: ", line.rstrip()
return line
except SelectError, e:
except SelectError as e:
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
else:
print "SelectError ({0}): {1}".format(e.errno, e.strerror)
raise
except SerialException, e:
print "Can't read from printer (disconnected?)."
except SerialException as e:
print "Can't read from printer (disconnected?) ({0}): {1}".format(e.errno, e.strerror)
return None
except OSError, e:
print "Can't read from printer (disconnected?)."
except OSError as e:
print "Can't read from printer (disconnected?) ({0}): {1}".format(e.errno, e.strerror)
return None
def _listen_can_continue(self):
......@@ -476,9 +477,9 @@ class printcore():
self.printer.write(str(command + "\n"))
self.printer.flush()
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:
print "Socket connection broken, disconnected."
print "Socket connection broken, disconnected. ({0}): {1}".format(e.errno, e.strerror)
if __name__ == '__main__':
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