AnsweredAssumed Answered

34465A returns u'\n' on "READ?" using pyvisa

Question asked by Dace on Jun 8, 2018
Latest reply on Jun 13, 2018 by tomc

I'm using PyVISA on python 2.7 to read a 34465A DMM over TCP.  I am able to execute an "*IDN?" query and it returns the correct value, however the "READ?" query simply returns u'\n'.  I've tried several variations including using '' vs "", as well as having preceding ':', using "MEAS:..."; no luck. Here is an example of my code:

 

import visa
import time

 

rm = visa.ResourceManager()
resources = rm.list_resources()
print "Available resources:"
print resources
print "Getting instrument..."
my_inst = rm.open_resource(resources[1]) # The device is always at [1]
start = time.time()
worked = True
command = "MEAS:VOLT:DC?" # Doesn't work

#command = "READ?" # Doesn't work
try:
    print "Got instrument, getting *IDN?..."
    print my_inst.query('*IDN?') # Prints correct value
    print "Got *IDN?, READ?ing..."
    print my_inst.query(command).split()
    print "READ? complete attempting, write/read."
    print my_inst.write(command)
    print "Wrote READ?, reading from inst..."
    print my_inst.read().split()
except Exception as e:
    worked = False
    print e
    print "Had an... exceptional time...."
finally:
    my_inst.close()
    print "Elapsed time:"
    print time.time() - start
    print "Did it work: {}".format(worked)

Outcomes