Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > [newbie] problem with module PyVisa

Reply
Thread Tools

[newbie] problem with module PyVisa

 
 
Jean Dubois
Guest
Posts: n/a
 
      11-09-2012
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.

>>> import visa

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
 
Reply With Quote
 
 
 
 
Rodrick Brown
Guest
Posts: n/a
 
      11-09-2012
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

On Nov 9, 2012, at 11:22 AM, Jean Dubois <(E-Mail Removed)> wrote:

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

 
Reply With Quote
 
 
 
 
Jean Dubois
Guest
Posts: n/a
 
      11-09-2012
On 9 nov, 17:40, Rodrick Brown <(E-Mail Removed)> wrote:
> 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
>
> On Nov 9, 2012, at 11:22 AM, Jean Dubois <(E-Mail Removed)> wrote:
>
>
>
>
>
>
>
> > OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared
> > object file: No such file or directory


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



 
Reply With Quote
 
Prasad, Ramit
Guest
Posts: n/a
 
      11-09-2012
Jean Dubois wrote:

>
> On 9 nov, 17:40, Rodrick Brown <(E-Mail Removed)> wrote:

> > 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
> >
> > On Nov 9, 2012, at 11:22 AM, Jean Dubois <(E-Mail Removed)> wrote:
> >

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

>
> 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/8...on-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.
 
Reply With Quote
 
Jean Dubois
Guest
Posts: n/a
 
      11-11-2012
On 9 nov, 22:14, (E-Mail Removed) wrote:
> On Nov 9, 2012, at 3:43 PM, Jean Dubois <(E-Mail Removed)> wrote:
>
>
>
>
>
>
>
>
>
>
>
> > 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

>
> > --
> >http://mail.python.org/mailman/listinfo/python-list

>
> 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/c...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
 
Reply With Quote
 
Jean Dubois
Guest
Posts: n/a
 
      11-20-2012
On 11 nov, 20:30, Jean Dubois <(E-Mail Removed)> wrote:
> On 9 nov, 22:14, (E-Mail Removed) wrote:
>
>
>
> > On Nov 9, 2012, at 3:43 PM, Jean Dubois <(E-Mail Removed)> wrote:

>
> > > 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

>
> > > --
> > >http://mail.python.org/mailman/listinfo/python-list

>
> > 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 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PyVISA Manatee Python 3 04-23-2011 12:26 AM
Re: PyVISA eryksun () Python 2 04-02-2011 02:24 AM
ANN: PyVISA 1.1 -- GPIB, USB, RS232 instrument control Torsten Bronger Python 0 11-22-2006 06:45 AM
ANN: PyVISA 1.0 -- GPIB, USB, RS232 instrument control Torsten Bronger Python 0 01-24-2006 01:48 PM
ANN: PyVISA 0.9 (first public release) Torsten Bronger Python 0 06-30-2005 09:24 AM



Advertisments