New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSError with wxPython #203
Comments
I also get a similar error by running the show_devices() function in usb.core
This code is what produces this error.
|
Issue reported here. |
|
Temporary workaround is to go back to libusb-1.0.21 where this issues does not manifest itself.
|
Or you can use libusb0 backend (libusb-win32). Take note libusb-win32 will only list the device which uses libusb-win32 compatible driver (libusb0.sys or libusbk.sys).
|
See comment in libusb/libusb#412. This is not a libusb issue.
|
So, it looks like this is a pyusb issue, is there any word on a fix? |
@mcuee How are things going with a fix for this error? |
Each call to libusb1's get_backend returns a new _LibUSB object. When each _LibUSB object falls out of scope, it calls ends up calling libusb_exit() which deinitializes libusb, even if there are still references in scope. Practically speaking, pyusb seems to assume there's only one context active, so returning the same _LibUSB object on subsequent calls to get_backend should prevent there from being more than one call to libusb_exit() when backend objects go out of scope. This should fix errors where the libusb library was being used after libusb_exit() had been called.
The patch for PyUSB successfully prevents access violation errors during cleanup with libusb 1.0.22, but "some libusb_devices were leaked" warnings can still be seen with LIBUSB_DEBUG=3. Patch: 8041ec11b2c4 ("Fix #203: libusb sometimes cleaned up too early.") Related: pyusb/pyusb#227 ("Fix #203: libusb sometimes cleaned up too early.") Related: pyusb/pyusb#203 ("OSError with wxPython #203")
Maybe the following can help. Ref: eblot/pyftdi#121
|
With the latest git, it seems to be okay, with latest libusb Windows.
|
No issues with wxusb.py either when I press the button.
|
@JoshMayberry Please check on your side. Thanks. |
@mcuee After using the latest version from the github, the problem was solved (No OSError when I ran the script I provided at the top of this issue). This fix is not, however, in the latest version on pypi.org. |
I understand (including from my own experience) that this is an annoying issue for downstream projects. I'll try to get a release ready soon, even if some other issues end up missing the cut. |
Any word on a release? |
I delayed the release because a few (unconfirmed but suspect) unrelated issues have surfaced. |
If I try to find the USB devices in a wxPython window, I get the following error:
Here is some simple code that can create the error.
To produce the error, press the button "Run test()" in the frame that appears after running the code.
The text was updated successfully, but these errors were encountered: