markwal / OctoPrint-GPX

An OctoPrint plug-in to use GPX as the protocol layer underneath rather than replacing g-code to talk to s3g/x3g machines, for example, a FlashForge.
GNU Affero General Public License v3.0
104 stars 25 forks source link

OSError: Generic Packet error on gpx.write(data) #95

Open guysoft opened 1 year ago

guysoft commented 1 year ago

Hey all, After printing a while I got this issue: Print hauled and failed.

2022-09-29 11:02:37,953 - octoprint.util.comm - INFO - Externally triggered heatup detected
2022-09-29 11:06:00,957 - octoprint.util.comm - ERROR - Unexpected error while writing to serial port
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4873, in _do_send_without_checksum
    result = self._serial.write(to_send)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_GPX/gpxprinter.py", line 138, in write
    self._append(gpx.write(data))
OSError: Generic Packet error
2022-09-29 11:06:01,165 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Offline after error"

The lines are from here: https://github.com/markwal/OctoPrint-GPX/blob/master/octoprint_GPX/gpxprinter.py#L138

Perhaps its worth to add a try/catch there and repeat the send? Or is there a better solution?

Thanks!