Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- printer_dev_path = None
- for port, desc, hwid in win32setupdi.printers(True):
- print "port=%-10s:\n desc=%s\n hwid=(%s)" % (port, desc, hwid)
- if port.find( vid_path ) > 0 and port.find( pid_path ) > 0 :
- printer_dev_path = port
- if printer_dev_path is None :
- print "Printer not attached."
- sys.exit(1)
- print "opening port={0}".format( printer_dev_path )
- file_handle = win32file.CreateFile( printer_dev_path,
- win32con.GENERIC_READ | win32con.GENERIC_WRITE,
- 0, # exclusive access
- None, # no security
- win32con.OPEN_EXISTING,
- win32con.FILE_ATTRIBUTE_NORMAL | win32con.FILE_FLAG_OVERLAPPED,
- None)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement