Search code examples
pythonthermal-printerescpos

Cannot run python-escpos methods


I have an Epson thermal printer (TM-82), connected via USB. I am using python-escpos library (version v2.2.0) I am trying to run some of Escpos module's methods such has ln(), textln(), etc. But none of these commands work, and I get an error 'Usb' object has no attribute <method_name>. The only commands that work are text(), qrcode(), barcode(), image() and cut().

Can you guys please tell me what's wrong?

Steps to reproduce

>>> from escpos import printer
>>> p = printer.Usb(0x04b8, 0x0e11, 0)
>>> p.text('hello')
>>> p.ln()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Usb' object has no attribute 'ln'
>>> p.is_online()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Usb' object has no attribute 'is_online'

Solution

  • If you are using python-escpos 2.2.0, look at the source and documentation for that version.

    There is no ln or is_online function in that version.