New to TSP programing and python in general. I have a Keithley 2470 I am issuing TSP commands through python. Pyvisa is installed (keithley version). Using Spyder for python. Here is the code: 

import pyvisa
import time
rm = pyvisa.ResourceManager()
# You can change the variable name and resource name
my2470 = rm.open_resource("USB0::0x05E6::0x2470::04574813::0::INSTR")
my2470.write("smu.source.func = smu.FUNC_DC_VOLTAGE")
my2470.write("smu.measure.func = smu.FUNC_DC_CURRENT")

my2470.write("smu.source.level = 1")
my2470.write("smu.source.output = smu.ON")
   
volt = my2470.query("print(defbuffer1.readings[defbuffer1.endindex])")

time.sleep(0.1)

my2470.write("smu.source.output = smu.OFF") 
my2470.close()

Problem: Query does not return values in defbuffer1. Output returns <TSP>. On the instrument itself, the buffer has data, but it can't be read back through the console
Thanks