Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   [newbie] problem with module PyVisa (http://www.velocityreviews.com/forums/t954368-newbie-problem-with-module-pyvisa.html)

Jean Dubois 11-09-2012 04:19 PM

[newbie] problem with module PyVisa
 
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

Rodrick Brown 11-09-2012 04:39 PM

Re: [newbie] problem with module PyVisa
 
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 <jeandubois314@gmail.com> wrote:

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


Jean Dubois 11-09-2012 08:43 PM

Re: problem with module PyVisa
 
On 9 nov, 17:40, Rodrick Brown <rodrick.br...@gmail.com> 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 <jeandubois...@gmail.com> 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




Prasad, Ramit 11-09-2012 09:16 PM

RE: problem with module PyVisa
 
Jean Dubois wrote:

>
> On 9 nov, 17:40, Rodrick Brown <rodrick.br...@gmail.com> 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 <jeandubois...@gmail.com> 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.

Jean Dubois 11-11-2012 07:30 PM

Re: problem with module PyVisa
 
On 9 nov, 22:14, w...@mac.com wrote:
> On Nov 9, 2012, at 3:43 PM, Jean Dubois <jeandubois...@gmail.com> 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

Jean Dubois 11-20-2012 01:28 PM

Re: problem with module PyVisa
 
On 11 nov, 20:30, Jean Dubois <jeandubois...@gmail.com> wrote:
> On 9 nov, 22:14, w...@mac.com wrote:
>
>
>
> > On Nov 9, 2012, at 3:43 PM, Jean Dubois <jeandubois...@gmail.com> 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


All times are GMT. The time now is 02:25 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.