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

Raised exception in the __del__ Picobase method #180

Open
elechapt opened this issue Jan 12, 2022 · 2 comments
Open

Raised exception in the __del__ Picobase method #180

elechapt opened this issue Jan 12, 2022 · 2 comments

Comments

@elechapt
Copy link
Contributor

The Picoscope object raise an exception if it can't be opened (which is fine), but if catched, another one is raised straight after at the garbage collector deletion, from _lowLevelCloseUnit in the Picobase.close() method, and generate an Exception ignored message, which is annoying when printing other informative messages about an emulated one taking over. Can the OSError be catched in the close() method ?
That's not much of a big issue, but just wanted to mention it.

@hmaarrfk
Copy link
Collaborator

Interesting. Clean __del__ methods are hard to do. A PR would be welcome!

@elechapt
Copy link
Contributor Author

Hi there, the close() method also rise a AttributeError exception when the self.handle attribute is not found, which happens when the picoscope is not connected and we "delete" the object (by assigning the variable to another object for example). I'll clean the method.

elechapt added a commit to elechapt/pico-python that referenced this issue Jun 26, 2023
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

2 participants