pico-python icon indicating copy to clipboard operation
pico-python copied to clipboard

Raised exception in the __del__ Picobase method

Open elechapt opened this issue 3 years ago • 2 comments

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.

elechapt avatar Jan 12 '22 17:01 elechapt

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

hmaarrfk avatar Jan 12 '22 18:01 hmaarrfk

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 avatar Jun 26 '23 09:06 elechapt