Hi I'm trying to make an instant camera out of a raspberry pi 3, a USB thermal printer, the raspberry pi camera, and a driver program (Excuse me if I'm using the term driver incorrectly) from adafruit called Adafruit_Thermal.py.
My problem is that when I try to run my program (actually at the moment just a standard program that came with the adafruit package called sudoku-gfx.py) it prints about half a line then stops. I'm using a USB thermal printer. Part of the setup was to tell the program to use a file called /dev/ttyUSB0. When the printer is connected to power this file can be found. When it's not this file does not exist. What's interesting is after I run this program, and I get my error message, if I go to find that file it will have been replaced by /dev/ttyUSB1.
Something else that was strange is yeasterday I had fixed this problem by changing the 'default port' to /dev/ttyUSB0 in the Adafruit_Thermal.py program. Strangely it seems I had only fixed my issue temporarily. The code was working fine yesterday but for some reason today it no longer works.
The error message looks like this:
Traceback (most recent call last): File "/home/pi/Documents/Python-Thermal-Printer-master/sudoku-gfx.py", line 237, in <module> main() File "/home/pi/Documents/Python-Thermal-Printer-master/sudoku-gfx.py", line 46, in main printer.printImage(bg, True) # This does the printing File "/home/pi/Documents/Python-Thermal-Printer-master/Adafruit_Thermal.py", line 489, in printImage self.printBitmap(width, height, bitmap, LaaT) File "/home/pi/Documents/Python-Thermal-Printer-master/Adafruit_Thermal.py", line 442, in printBitmap self.writeBytes(18, 42, chunkHeight, rowBytesClipped) File "/home/pi/Documents/Python-Thermal-Printer-master/Adafruit_Thermal.py", line 173, in writeBytes super(Adafruit_Thermal, self).write(chr(arg)) File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 489, in write raise SerialException('write failed: %s' % (v,)) SerialException: write failed: [Errno 19] No such device
The driver program I'm using can be found here:
https://github.com/adafruit/Python-Thermal-Printer
If you can help in anyway or even simply recommend a better way of doing this please let me know. Thanks you.