[newbie] problem with module PyVisa

J

Jean Dubois

I'm trying to control a programmable power supply via USB using
python.
After doing some googling I thought I should use PyVisa for this
purpose, so I installed it as follows:
tar xvfz PyVISA-1.4.tar.gz
cd PyVISA-1.4
python setup.py install

Installation seems to finish without errors.

When I start a python session things go wrong as you can see in the
output below,
can anyone here tell me how to proceed correctly? thanks in advance.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/PyVISA-1.4-py2.6.egg/
visa.py", line 1, in <module>
from pyvisa.visa import *
File "/usr/local/lib/python2.6/dist-packages/PyVISA-1.4-py2.6.egg/
pyvisa/visa.py", line 231, in <module>
resource_manager = ResourceManager()
File "/usr/local/lib/python2.6/dist-packages/PyVISA-1.4-py2.6.egg/
pyvisa/vpp43.py", line 105, in __new__
it.init(*args, **kwds)
File "/usr/local/lib/python2.6/dist-packages/PyVISA-1.4-py2.6.egg/
pyvisa/visa.py", line 227, in init
self.session = self.vi = vpp43.open_default_resource_manager()
File "/usr/local/lib/python2.6/dist-packages/PyVISA-1.4-py2.6.egg/
pyvisa/vpp43.py", line 758, in open_default_resource_manager
visa_library().viOpenDefaultRM(byref(session))
File "/usr/local/lib/python2.6/dist-packages/PyVISA-1.4-py2.6.egg/
pyvisa/vpp43.py", line 175, in __call__
self.load_library()
File "/usr/local/lib/python2.6/dist-packages/PyVISA-1.4-py2.6.egg/
pyvisa/vpp43.py", line 146, in load_library
self.__lib = self.__cdecl_lib = cdll.LoadLibrary(path)
File "/usr/lib/python2.6/ctypes/__init__.py", line 431, in
LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.6/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared
object file: No such file or directory
 
R

Rodrick Brown

It seems pretty obvious from the error. Try installing the missing lib packages.

OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared
object file: No such file or directory


Sent from my iPhone
 
J

Jean Dubois

It seems pretty obvious from the error. Try installing the missing lib packages.

OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared
object file: No such file or directory

Sent from my iPhone

The error may be obvious but finding this file and how to install it
is not unfortunately.
It seems I have to install it from the National Instruments site but
Debian Linux doesn't seem to be supported...
and I doubt whether just copying this file will be sufficient to make
PyVisa work.
I wonder whether there might be another way to communicate via USB
with a Keithley programmable power supply using Python.

best regards,
Jean
 
P

Prasad, Ramit

Jean said:
The error may be obvious but finding this file and how to install it
is not unfortunately.
It seems I have to install it from the National Instruments site but
Debian Linux doesn't seem to be supported...
and I doubt whether just copying this file will be sufficient to make
PyVisa work.
I wonder whether there might be another way to communicate via USB
with a Keithley programmable power supply using Python.

Here are some reference links that might help.
http://stackoverflow.com/questions/8140248/linux-implementation-of-visa-api
https://decibel.ni.com/content/message/37590


Hope that helps,
Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information,viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
 
J

Jean Dubois

I've been using pyserial quite successfully to control a USB-to-serial converter.

That is, controlling a couple of RS232 serial devices via the USB port through a KeySpan USB-to-Serial converter.

Pyserial seems to make communication through the USB port quite transparent, at least on my OS-X system.

-Bill

Well, in fact I do have some working scripts using pyserial to control
an older (and more expensive) Keithley sourcemeter in combination with
a USB-to-serial converter.
But the trouble started when buying a cheaper and newer Keithley model
which does not have rs232 but only USB. I noticed they have put an
extra layer above USB called USBTMC
which complicates things further. I followed the instructions at
http://www.home.agilent.com/upload/....htm?&cc=BE&lc=dut#3.Copyright Notice|outline
and compiled and loaded the usbtmc-driver but I still can't
communicate with the Keithley, hence I started looking for an
alternative using PyVisa...and now I'm stuck

jean
 
J

Jean Dubois

Well, in fact I do have some working scripts using pyserial to control
an older (and more expensive) Keithley sourcemeter in combination with
a USB-to-serial converter.
But the trouble started when buying a cheaper and newer Keithley model
which does not have rs232 but only USB. I noticed they have put an
extra layer above USB called USBTMC
which complicates things further. I followed the instructions athttp://www.home.agilent.com/upload/cmc_upload/All/usbtmc.htm?&cc=BE&l...outline
and compiled and loaded the usbtmc-driver but I still can't
communicate with the Keithley, hence I started looking for an
alternative using PyVisa...and now I'm stuck

jean

I finally got it working without PyVisa as follows:
#!/usr/bin/python
#sample program for Keithley 2200 USB
#first compile and load module usbtmc
import os
usbkeith = open('/dev/usbtmc1','r+')
#next commando is very important
#without it you can fetch data but not SET data
usbkeith.write("SYST:REM" + "\n")
usbkeith.write("*IDN?\n")
identification=usbkeith.readline()
print 'Found: ',identification
usbkeith.write("SOUR:CURR 0.2A\n")
usbkeith.write("SOUR:OUTP:STAT ON\n")
usbkeith.write("MEAS:VOLT?\n")
measurement=usbkeith.readline()
print 'Measured voltage: ',measurement

regards,
jean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top