Skip to content
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

error while running example_linux_continous_read.py #34

Open
piotx opened this issue Aug 17, 2016 · 4 comments
Open

error while running example_linux_continous_read.py #34

piotx opened this issue Aug 17, 2016 · 4 comments

Comments

@piotx
Copy link

piotx commented Aug 17, 2016

Hallo,

thanks for sharing your API.

I get an error, when running example_linux_continous_read.py

python example_linux_continous_read.py

Clearing FIFO and starting data transfer...
Stopping new transfers.
Snooze 1
Closing handle
Traceback (most recent call last):
File "example_linux_continous_read.py", line 68, in
scope.close_handle()
File "/usr/local/lib/python2.7/dist-packages/Python_Hantek_6022BE_Wrapper-0.0.2-py2.7.egg/PyHT6022/LibUsbScope.py", line 116, in close_handle
self.device_handle.close()
File "build/bdist.linux-x86_64/egg/usb1.py", line 1113, in close
File "build/bdist.linux-x86_64/egg/usb1.py", line 737, in cancel
libusb1.USBError: LIBUSB_ERROR_NOT_FOUND [-5]
Exception usb1.USBErrorNotFound: USBErrorNotFound() in <bound method Oscilloscope.del of <PyHT6022.LibUsbScope.Oscilloscope object at 0x7f616c3bc2d0>> ignored
Exception libusb1.USBError: USBError() in <bound method USBDeviceHandle.del of <usb1.USBDeviceHandle object at 0x7f6169323190>> ignored

So the device can not be accessed, from what I understand.. Any ideas how to solve the problem?

@jhoenicke
Copy link
Collaborator

I think you need to install libusb, e.g.

sudo apt install libusb-1.0-0-dev

@piotx
Copy link
Author

piotx commented Aug 21, 2016

well, I have installed it, but it doesn't make any difference; the error comes only, when closing the handly, so I just moved the command to the end of the script.

@vpelletier
Copy link

Hello, python-libusb1 dev here.

@rpcope1:
Earlier this year I improved the interpreter exit situation by avoiding dependency on destructors, as they do not follow object references (ie, if object A references object B and both have __del__ methods, A.__del__ may still be invoked before B.__del__). To avoid such interpreter-shutdown-time errors, you may want to either explicitly call USBContext.close or use with to manage the lifetime of USBContext instance (which likely means using it to manage the lifetime of Oscilloscope class with it and calling USBContext.close from Oscilloscope.__exit__).

File "build/bdist.linux-x86_64/egg/usb1.py", line 1113, in close
File "build/bdist.linux-x86_64/egg/usb1.py", line 737, in cancel
libusb1.USBError: LIBUSB_ERROR_NOT_FOUND [-5]

This is a bug in python-libusb1: while USBErrorNotFound exception is caught in USBDeviceHandle.close, it is USBError (the base exception class) which is raised in USBTransfer.close.
This should be fixed by vpelletier/python-libusb1@7a4b8d8 which I released today as 1.5.2 .

@akloster
Copy link

akloster commented Sep 6, 2018

I'm getting the same error. I am running on Ubuntu, I tried with system python +python-libusb from official sources, pypi and github, and anaconda with python-libusb1 1.6.6. Uploading firmware seems to work.

OpenHantek also works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants