Skip to content
This repository was archived by the owner on Feb 2, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions ivi/interface/pyvisa.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@
visa_instrument_opener = visa.instrument
except ImportError:
# PyVISA not installed, pass it up
raise ImportError
except:
raise
except Exception as e:
# any other error
e = sys.exc_info()[1]
sys.stderr.write("python-ivi: PyVISA is installed, but could not be loaded (%s: %s)\n" %
(e.__class__.__name__, e.args[0]))
raise ImportError
raise ImportError("python-ivi: PyVISA is installed, but could not be loaded (%s)\n" % repr(e))

class PyVisaInstrument:
"PyVisa wrapper instrument interface client"
Expand Down Expand Up @@ -104,28 +101,28 @@ def ask(self, message, num=-1, encoding = 'utf-8'):

def read_stb(self):
"Read status byte"
raise NotImplementedError()
return self.instrument.read_stb()

def trigger(self):
"Send trigger command"
self.instrument.trigger()

def clear(self):
"Send clear command"
raise NotImplementedError()
self.instrument.clear()

def remote(self):
"Send remote command"
raise NotImplementedError()
self.instrument.gpib_control_ren(visa.constants.VI_GPIB_REN_ASSERT_ADDRESS)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend using the control_ren method instead, as this should be generic enough across different types of VISA connections.

For reference, see ControlRenMixin in https://github.com/hgrecco/pyvisa/blob/898b948ec835f3cac8ee4aaec9317237ad5a31bd/pyvisa/resources/messagebased.py

def local(self):
"Send local command"
raise NotImplementedError()
self.instrument.gpib_control_ren(visa.constants.VI_GPIB_REN_DEASSERT_GTL)

def lock(self):
"Send lock command"
raise NotImplementedError()
self.instrument.lock()

def unlock(self):
"Send unlock command"
raise NotImplementedError()
self.instrument.unlock()