我正在Win 10下使用python(pyUSB)开发一个小型USB应用程序,并且存在以下问题。
当我在python控制台下测试基本命令时,一切正常。我可以打开设备,向其中写入字节并从中读取。
接下来,我试图将所有内容放到一个tkinter应用程序中,并使用VSCode对其进行调试。在这里,我不断收到以下错误:
File "c:\Test\usbtester\main.py", line 198, in usb_open
self.dev.set_configuration()
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 869, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 147, in managed_set_configuration
self.managed_open()
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\core.py", line 120, in managed_open
self.handle = self.backend.open_device(self.dev)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\backend\libusb1.py", line 787, in open_device
return _DeviceHandle(dev)
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\backend\libusb1.py", line 644, in __init__
_check(_lib.libusb_open(self.devid, byref(self.handle)))
File "c:\Program Files\Python37\usbtenv\lib\site-packages\usb\backend\libusb1.py", line 596, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
有人可以建议我在这里做错什么吗?