11-01-2006 06:45 PM
I am trying to use pyvisa 1.0, python 2.5 with GPIB-USB-HS (http://sine.ni.com/nips/cds/view/p/lang/en/nid/201586).
Python and pyvisa is all native windows application (not cygwin). I am able to get a serial port resource just
fine (which shows that my application installed fine), but I am not able to connect to the GPIB device.
and I can talk to it using the National Instrumant tools (which refer to the device as UD0).
Here is the error message that I get...If you have any other methods or recommendation to
use this device using python, please let me know.
>>> b = Instrument("GPIB0::18")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python25\Lib\site-packages\pyvisa\visa.py", line 342, in __init__
"lock")))
File "C:\Python25\Lib\site-packages\pyvisa\visa.py", line 124, in __init__
keyw.get("lock", VI_NO_LOCK))
File "C:\Python25\Lib\site-packages\pyvisa\vpp43.py", line 699, in open
byref(vi))
File "C:\Python25\Lib\site-packages\pyvisa\vpp43.py", line 344, in
check_status raise visa_exceptions.VisaIOError, status
pyvisa.visa_exceptions.VisaIOError: VI_ERROR_RSRC_NFOUND: Insufficient location
information or the requested device or resource is not present in the system.
>>>
11-02-2006 08:10 AM
11-02-2006 04:57 PM
06-21-2013 04:42 PM
I also am having a nearly identical experience. I am attempting to communicate with HP54542A using pyVISA and ni-488.2 protocal. I use the Meas.Aut.Exp (MAX) to identify my device which has the primary address of 0 but listed as INSTR. 0 at PAD 7. I can use the API commands such as *IDN? and MEAS:TVOL to identify and extract voltage measurements from the scope using the national instruments interactive controller in MAX. I simply want to build a ten line code to do the same thing=> sample the voltage many times and then save that info or display it using python pyVISA code.
from visa import instrument
my_instrument = instrument("GPIB0::7::INSTR")
my_instrument.write("*IDN?")
print my_instrument.read()
When I run this simple example from pyVISA, it gives the error "syntax error" and highlights the final line ( my_instrument. -part only-) which seems to tell me that it is the write and read commands from ni-488 protocal that is not being understood properly. I tried changing the GPIB0:: to 0 and 7 and 14::INSTR but it did not change the response. This should work and be exceedingly trivial but I must have made some subtle error?
Oh. and the "UDO" refered to in the previous post is from the MAX interactive controller window after using the ibdev command and I did successfully query the identity of the device and extract voltages etc.. I just want it to work in python as well as it did in the MAX interactive controller which is activated by hitting a tab on the upper window bar of the MAX window
06-21-2013 04:45 PM
I am using Python 3.3.2 and pyVISA-1.4.win32 and ni-488.2...
06-24-2013 10:30 PM
iREMs3,
I notice that your write command does not include a '/n' or any other type of termination character. I'm not all that familiar with Python, however I think these termination characters are default in the MAX interactive controller.
06-24-2013 11:41 PM
07-01-2013 12:30 PM
You were correct. I am using python 3.3. For a reason unknown to me, pyvisa did not import with this version. I uninstalled the software and reinstalled 2.6.7 version. I found this out by typing the commands into the dos prompt line by line and using traceback errors. The python code was flawlessly implemented using this older version. I performed all the functions MAX was capable of implementing. It was clear as you pointed out that if MAX recieved the command prompts that the python implementator of the module must have been at fault (actually I was for not reading the 100 page update report on python 3.3). Thank you for the hospitality of the board. I am certain that other users of ni-hardware and software will appreciate this notification since I would have appreciated it. My laboratory colleague is also preparing LabVIEW software for the same device. Great service and company....
09-09-2014 08:20 AM
03-29-2021 04:38 PM - edited 03-29-2021 04:43 PM
Hi guys,
I am trying to connect GPIB-USB-HS and pay visa. I believe the correct visa resources are not shown in my code. The reason behind my statement is that when I disconnect GPIB-USB-HS from my PC, I am still getting the same visa resources. Is there anyone who helps me with this issue?
import pyvisa as visa
inst = visa.ResourceManager()
inst.list_resources()
Thank you,