使用escpos.printer将Python打印到打印机

时间:2019-04-03 07:25:48

标签: python

我正在尝试使用python escpos.printer模块打印到打印机,但始终收到此错误NotImplementedError:在此平台上不支持或未实现操作,搜索无济于事,我使用的是Windows 7 64位操作系统。这是escpos.printer的默认代码 我也找到了这个答案,但它没有用Pyusb on Windows 7 - NotImplemented Error :is_kernal_driver_active

[docs](https://python-escpos.readthedocs.io/en/latest/index.html)!
from escpos.printer import Usb

""" Seiko Epson Corp. Receipt Printer (EPSON TM-T88III) """
p = Usb(0x0483,0x5743)
p.text("Hello World\n")
p.image("logo.gif")
p.barcode('1324354657687', 'EAN13', 64, 2, '', '')
p.cut()
Traceback (most recent call last):
  File "C:\Users\admin\Desktop\test\testGround\test.py", line 50, in <module>
    p = Usb(0x0483,0x5743)
  File "C:\Python36\lib\site-packages\escpos\printer.py", line 51, in __init__
    self.open()
  File "C:\Python36\lib\site-packages\escpos\printer.py", line 77, in open
    self.device.set_configuration()
  File "C:\Python36\lib\site-packages\usb\core.py", line 869, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
  File "C:\Python36\lib\site-packages\usb\core.py", line 102, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Python36\lib\site-packages\usb\core.py", line 147, in managed_set_configuration
    self.managed_open()
  File "C:\Python36\lib\site-packages\usb\core.py", line 102, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Python36\lib\site-packages\usb\core.py", line 120, in managed_open
    self.handle = self.backend.open_device(self.dev)
  File "C:\Python36\lib\site-packages\usb\backend\libusb1.py", line 786, in open_device
    return _DeviceHandle(dev)
  File "C:\Python36\lib\site-packages\usb\backend\libusb1.py", line 643, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "C:\Python36\lib\site-packages\usb\backend\libusb1.py", line 593, in _check
    raise NotImplementedError(_strerror(ret))
NotImplementedError: Operation not supported or unimplemented on this platform
[Finished in 0.3s]

0 个答案:

没有答案