Open cridder opened 4 years ago
I'm also encountering this - I just commented out that function and the println function for now
Ok so what did it for me in the end was changing my calls to use sudo python3
rather than plain-old sudo python
even though I have python
alias'd to python3 on my machine. IDK enough about linux and/or python to know why, though.
^Right, or change the first line in the sample scripts to #!/usr/bin/python3
When printer.println
is called in the examples, the imported printer library tries to overload Python's built-in print
with its own. In Python 2, print
is a statement rather than a function, so it can't be overloaded and the syntax error is thrown. In Python 3, print
changed from a statement to a function, so it can be successfully overloaded.
i reinstalled and updated from this repo.
any suggestions.
thanks.
pi@raspberrypi:~/Python-Thermal-Printer $ python printertest.py Traceback (most recent call last): File "printertest.py", line 3, in
from Adafruit_Thermal import
File "/home/pi/Python-Thermal-Printer/Adafruit_Thermal.py", line 725
def print(self, args, **kwargs):
^
SyntaxError: invalid syntax