简体   繁体   中英

I can't get PyWinUSB examples to work

I'm trying to get the examples from pywinusb to work, but to no avail.

My setup is:

  • python3.3 on Windows7-64 bits
  • pywinusb-0.3.2 installed with the "python setup.py install" script

I get this output:

E:\pywinusb-0.3.2\examples>python show_hids.py

Found HID class devices!, writting details...
Traceback (most recent call last):
  File "show_hids.py", line 71, in <module>
    print_all()
  File "show_hids.py", line 68, in print_all
    hid.core.show_hids()
  File "D:\Python33\lib\site-packages\pywinusb-0.3.2-py3.3.egg\pywinusb\hid\core.py", line 1563, in show_hids
  File "D:\Python33\lib\codecs.py", line 356, in write
    self.stream.write(data)
TypeError: must be str, not bytes

As you see, I'm running the script directly from the console.

I'm a seasoned C programmer just learning Python. Could it be an incompatibility with Python 2/3? I'm thinking something in my setup is wrong. I don't think the examples would be faulty.

Try Python 2.7 if possible, that's the primary testing platform (might change soon though).

The latest code is on the github repository. I just tested that is works on Python 3.3 (and 3.4) using pyWinUsb version 0.3.6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM