Skip to content

Noise in console from extra call to close_unit when no ps2000 is connected #214

Description

@premnetsuwan-tpeng

If I try and connect to a ps2000 with this code:

from picoscope import ps2000

ps = ps2000.PS2000()

and I dont have anything connected, I get this in the console:

Exception ignored in: <function _PicoscopeBase.__del__ at 0x00000266E0C10180>
Traceback (most recent call last):
  File "C:\Users\Prem Netsuwan\Documents\tpeng\testing\python-test\.venv\Lib\site-packages\picoscope\picobase.py", line 1139, in __del__
  File "C:\Users\Prem Netsuwan\Documents\tpeng\testing\python-test\.venv\Lib\site-packages\picoscope\picobase.py", line 1131, in close
  File "C:\Users\Prem Netsuwan\Documents\tpeng\testing\python-test\.venv\Lib\site-packages\picoscope\ps2000.py", line 167, in _lowLevelCloseUnit
  File "C:\Users\Prem Netsuwan\Documents\tpeng\testing\python-test\.venv\Lib\site-packages\picoscope\ps2000.py", line 340, in checkResult
OSError: Error calling _lowLevelCloseUnit

It seems like the close method is getting called, even though the picoscope was never connected, which results in this error. Since the error occurred in the __del__ method, python swallows and prints and there is no way for me to catch it. This causes extra stuff to get printed to the console which is unclear how I can avoid.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions