0

I am trying to control Rohde & Schwarz signal generator using PyVISA

PyVISA details is as follows.

C:\Python27\lib\site-packages\pyvisa\ctwrapper\functions.py:1222: VisaIOWarning: VI_WARN_CONFIG_NLOADED (1073676407): The specified configuration either does not exist or could not be loaded. VISA-specified defaults will be used.
 ret = library.viOpenDefaultRM(byref(session))
Machine Details:
 Platform ID: Windows-8-6.2.9200
 Processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
Python:
 Implementation: CPython
 Executable: C:\Python27\python.exe
 Version: 2.7.9
 Compiler: MSC v.1500 32 bit (Intel)
 Bits: 32bit
 Build: Dec 10 2014 12:24:55 (#default)
 Unicode: UCS2
PyVISA Version: 1.7
Backends:
 ni:
 Version: 1.7 (bundled with PyVISA)
 #1: C:\Windows\system32\visa32.dll:
 found by: auto
 bitness: 32
 Vendor: National Instruments
 Impl. Version: 5243905
 Spec. Version: 5243136
 #2: C:\Windows\system32\visa32.dll:
 found by: auto
 bitness: 32
 Vendor: National Instruments
 Impl. Version: 5243905
 Spec. Version: 5243136

NI-VISA version is 5.4.1. Here is what I get when I run following code

>>> import visa
>>> rm = visa.ResourceManager()
C:\Python27\lib\site-packages\pyvisa\ctwrapper\functions.py:1222: VisaIOWarning: VI_WARN_CONFIG_NLOADED (1073676407): The specified configuration either does not exist or could not be loaded. VISA-specified defaults will be used.
 ret = library.viOpenDefaultRM(byref(session))
>>> RAS = rm.open_resource('TCPIP::10.8.9.16::5025::SOCKET')
>>> RAS.ask("*idn?")
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "C:\Python27\lib\site-packages\pyvisa\resources\messagebased.py", line 387, in query
 return self.read()
 File "C:\Python27\lib\site-packages\pyvisa\resources\messagebased.py", line 312, in read
 message = self.read_raw().decode(enco)
 File "C:\Python27\lib\site-packages\pyvisa\resources\messagebased.py", line 286, in read_raw
 chunk, status = self.visalib.read(self.session, size)
 File "C:\Python27\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1582, in read
 ret = library.viRead(session, buffer, count, byref(return_count))
 File "C:\Python27\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 188, in _return_handler
 raise errors.VisaIOError(ret_value)
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
>>>

Does anyone know what am I doing wrong?

asked May 20, 2015 at 20:59

2 Answers 2

1

I figured it out. instead of doing

RAS = rm.open_resource('TCPIP::10.8.9.16::5025::SOCKET')

I just had to do

RAS = rm.open_resource('TCPIP::10.8.9.16::inst0::INSTR')

or

RAS = rm.open_resource('TCPIP::10.8.9.16::INSTR')

either works

answered May 20, 2015 at 22:50
Sign up to request clarification or add additional context in comments.

Comments

-1
 import visa
 import socket
 try:
 #open connection
 rm = visa.ResourceManager()
 c = (rm.list_resources())
 myinst = rm.open_resource('TCPIP::xxx.xxx.xxx.xxx::inst0::INSTR')
 #Close Connection
 myinst.close()
 print 'close instrument connection'
 except Exception as err:
 print 'Exception: ' + str(err.message)
 finally:
 #perform clean up operations
 print 'complete'
answered Oct 25, 2015 at 23:04

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.