Skip to content

Error thrown with Pyvisa due to gpib_ctypes? #1

@mb711

Description

@mb711

Hi,

I'm using python to talk to instruments over GPIB. My full script runs successfully, but I always get an error thrown in the python window at the very end of the run. I truncated my code to just the root of the issue, shown below. The error is also shown. Due to the error type, I've tried closing all my instruments and types, but no success. The error thrown is the same with and without the bottom portion of the code.

Also, I wasn't able to successfully talk to the instruments without the make_default_gpib() command. Calling this solved my issues, so it seems to be required for me.

import visa
import gpib_ctypes

from gpib_ctypes import make_default_gpib
make_default_gpib()

rm = visa.ResourceManager("C:\\Windows\\System32\\visa32.dll")
instr = rm.open_resource("GPIB0::5::INSTR")

Everything Below is code added to try to solve the issue
#Issue exist with and without below code
instr.__del__()
instr.close()
rm.close()
del instr
rm.__del__()
del rm

Error:

Exception ignored in: <function Gpib.__del__() at 0x02f60bb8>
Traceback (most recent call last):
     File "C:\Python37-32\lib\site-packages\gpib_ctypes\Gpib.py", line 37, in __del__
     File "C:\Python37-32\lib\site-packages\gpib_ctypes\gpib\gpib.py", line 230, in close
gpib_ctypes.gpib.gpib.GpibError: close() error: Iberr 23, invalid handle

Any help is greatly appreciated.

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