无法运行pythonescpos方法

2024-03-29 12:49:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一台爱普生热敏打印机(TM-82),通过USB连接。我正在使用python-escpos库(版本v2.2.0),我试图运行一些Escpos module's方法,例如ln()textln()等。但是这些命令都不起作用,我得到一个错误'Usb' object has no attribute <method_name>。唯一有效的命令是text()qrcode()barcode()image()和{}。在

你们能告诉我怎么了吗?在

复制步骤

>>> 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'

Tags: notext命令mostobjectattributecallprinter