gray_farz
Posts: 34
Joined: Mon Mar 20, 2017 6:13 am

error : USBPrinter instance has no attribute '_Generic__write'

Sun Jul 30, 2017 3:56 am

hello friends...
i want to setup a thermal printer by python-printer-escpos module...
my code is :

Code: Select all

from escpos.connections import getUSBPrinter


printer = getUSBPrinter()(idVendor=0x0483,
                          idProduct=0x5720,
                          inputEndPoint=0x81,
                          outputEndPoint=0x01) # Create the printer object with the connection params

printer.text("Hello World")
printer.lf()
i get this error :

Code: Select all

Traceback (most recent call last):
  File "/home/pi/start/printerr/poss/NEW/py-print-escposs.py", line 8, in <module>
    outputEndPoint=0x01) # Create the printer object with the connection params
  File "/usr/local/lib/python2.7/dist-packages/escpos/connections.py", line 89, in __init__
    self.initialize()
  File "/usr/local/lib/python2.7/dist-packages/escpos/commandset/generic.py", line 463, in initialize
    self.__write(self.__class__.__ESC + '@')
AttributeError: USBPrinter instance has no attribute '_Generic__write'
what is problem?????
please help
i need it instantly

ait
Posts: 127
Joined: Sun Oct 30, 2011 6:51 pm

Re: error : USBPrinter instance has no attribute '_Generic__write'

Sun Jul 30, 2017 11:25 am

Hello,
(idVendor=0x0483,
idProduct=0x5720,
0483:5720 seemed to be a USB flashdrive
Bus 003 Device 009: ID 0483:5720 STMicroelectronics STM microSD Flash Device

User avatar
scruss
Posts: 2419
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: error : USBPrinter instance has no attribute '_Generic__write'

Sun Jul 30, 2017 2:21 pm

Some of these USB printers have no descriptive text in the lsusb output, so it's easy to use the wrong device.

(which is another way of saying I've done this too …)
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Python”