Skip to content

VISA library path of simulated instrument #54

Open

Description

@juan-afc-ds

Hi,

I've set up a virtual environment for pythn 3.4.3 where I want to use Lantz. Given that I'm on a Debian-based distro right now, I can't trivially install the NI-VISA backend. Because of this, I've given pyvisa-py and pyvisa-sim a go. I'm going through the tutorials and I'm having problems understanding why I am getting an "OSError: Could not open VISA library." I've got to the point in the setup that if I launch in one terminal window:

lantz-sim fungen tcp

and then in another terminal I execute the script:

import visa
rm = visa.ResourceManager('@SiM')
rm.list_resources()

I get no output. I reckon this is good, because if do not launch "lantz-sim fungen tcp" I get the following error after execution of the script:

Traceback (most recent call last):
File "visa_test.py", line 3, in
rm = visa.ResourceManager()
File "/home/nomint/Documents/ProCon_FOSS/lantz_test/lib/python3.4/site-packages/pyvisa /highlevel.py", line 1488, in new
visa_library = open_visa_library(visa_library)
File "/home/nomint/Documents/ProCon_FOSS/lantz_test/lib/python3.4/site-packages/pyvisa /highlevel.py", line 1460, in open_visa_library
return cls(argument)
File "/home/nomint/Documents/ProCon_FOSS/lantz_test/lib/python3.4/site-packages/pyvisa/highlevel.py", line 96, in new
raise OSError('Could not open VISA library:\n' + '\n'.join(errs))
OSError: Could not open VISA library:

This makes sense to me. Yet, if I execute the following code found in the tutorials (with the funcgen simultaneously listening):

from lantz.drivers.examples import LantzSignalGenerator

inst = LantzSignalGenerator('TCPIP::localhost::5678::SOCKET')
inst.initialize()
print(inst.idn)
inst.finalize()

I get the error:
File "test_fungen.py", line 3, in
inst = LantzSignalGenerator('TCPIP::localhost::5678::SOCKET')
File "/home/nomint/Documents/ProCon_FOSS/lantz_test/lib/python3.4/site-packages/lantz/messagebased.py", line 296, in init
self.resource_manager = get_resource_manager()
File "/home/nomint/Documents/ProCon_FOSS/lantz_test/lib/python3.4/site-packages/lantz/messagebased.py", line 39, in get_resource_manager
_resource_manager = visa.ResourceManager()
File "/home/nomint/Documents/ProCon_FOSS/lantz_test/lib/python3.4/site-packages/pyvisa/highlevel.py", line 1488, in __new

visa_library = open_visa_library(visa_library)
File "/home/nomint/Documents/ProCon_FOSS/lantz_test/lib/python3.4/site-packages/pyvisa/highlevel.py", line 1460, in open_visa_library
return cls(argument)
File "/home/nomint/Documents/ProCon_FOSS/lantz_test/lib/python3.4/site-packages/pyvisa/highlevel.py", line 96, in new
raise OSError('Could not open VISA library:\n' + '\n'.join(errs))
OSError: Could not open VISA library:

I read the "configuring the NI backend" part of the docs, but I'm don't get how to apply that to my case. I have firstly no .pyvisarc file (I reckon I'd just have to create one à la .bashrc) and secondly (and most importantly) don't know where the libvisa is. I went through the pyvisa-py and pyvisa-sim folders and there are only py scripts, so dunno what I should point at. In the actual script there is no longer any '@SiM' argument, so I'm pretty lost right now.

I'd greatly appreciate any help. Looking heavily forward to trying out Lantz!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions