2

I try to print a ticket in a thermal printer. I use module escpos

but when I run the script in Windows it sends me the following error

Traceback (most recent call last):
      File "C:\Users\Angel\Desktop\Escritorio\impreimer.py", line 5, in <module>
        Epson = printer.Usb(0x1a86,0x7584,1)
      File "C:\Users\Angel\AppData\Local\Programs\Python\Python36\lib\site-packages\escpos\printer.py", line 51, in __init__
        self.open()
      File "C:\Users\Angel\AppData\Local\Programs\Python\Python36\lib\site-packages\escpos\printer.py", line 68, in open
        self.device.detach_kernel_driver(0)
      File "C:\Users\Angel\AppData\Local\Programs\Python\Python36\lib\site-packages\usb\core.py", line 1077, in detach_kernel_driver
        interface)
      File "C:\Users\Angel\AppData\Local\Programs\Python\Python36\lib\site-packages\usb\backend\libusb0.py", line 606, in detach_kernel_driver
        _check(_lib.usb_detach_kernel_driver_np(dev_handle, intf))
      File "C:\Users\Angel\AppData\Local\Programs\Python\Python36\lib\ctypes\__init__.py", line 361, in __getattr__
        func = self.__getitem__(name)
      File "C:\Users\Angel\AppData\Local\Programs\Python\Python36\lib\ctypes\__init__.py", line 366, in __getitem__
        func = self._FuncPtr((name_or_ordinal, self))
    AttributeError: function 'usb_detach_kernel_driver_np' not found
    [Finished in 0.5s with exit code 1]

and this is my code:

import sys
from escpos import *

pr = printer.Usb(0x1a86,0x7584)

How can i fix this?

Mystic_Force
  • 263
  • 3
  • 12

1 Answers1

0

try this.

pr = printer.Usb(0x1a86,0x7584, interface=0, in_ep=0x82, out_ep=0x02)

if you are using Windows you need use programs like zadig or LibusbK and install filters.

https://zadig.akeo.ie/

http://libusbk.sourceforge.net/UsbK3/index.html

loppra
  • 61
  • 1
  • 2