Download 1.6 PDF - Read the Docs

Transcript
PyVISA Documentation, Release 1.6
If you are doing:
>>> print(visa.get_instruments_list())
change it to:
>>> print(rm.list_resources())
If you are doing:
>>> import pyvisa.vpp43 as vpp43
>>> vpp43.visa_library.load_library("/path/to/my/libvisa.so.7")
change it to:
>>> import visa
>>> rm = visa.ResourceManager("/path/to/my/libvisa.so.7")
>>> lib = rm.visalib
If you are doing::
>>> vpp43.lock(session)
change it to:
>>> lib.lock(session)
or better:
>>> resource.lock()
If you are doing::
>>> inst.term_chars = '\r'
change it to:
>>> inst.read_termination = '\r'
>>> inst.write_termination = '\r'
If you are doing::
>>> print(lib.status)
change it to:
>>> print(lib.last_status)
or even better, do it per resource:
>>> print(rm.last_status) # for the resource manager
>>> print(inst.last_status) # for a specific instrument
As you see, most of the code shown above is making a few things explict. It adds 1 line of code (instantiating the
ResourceManager object) which is not a big deal but it makes things cleaner.
If you were using printf, queryf, scanf, sprintf or sscanf of vpp43, rewrite as pure Python code (see below).
If you were using Instrument.delay, change your code or use Instrument.query_delay (see below).
A few alias has been created to ease the transition:
• ask -> query
20
Chapter 3. More information