PyTektronixScope
PyTektronixScope copied to clipboard
VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
Thank you for the previous reply in regards to clarifying the difference between the PyPI and Github versions of the library. I have now run into a new problem trying to use read_data_one_channel on my Tektronix oscilloscope. Code is as follows:
import pyvisa
from PyTektronixScope import TektronixScope
from tkinter import Tk
import numpy as np
from struct import unpack
from tkinter import filedialog
import pylab
rm = pyvisa.ResourceManager('@ni')
#Choose the IP address of Scope to connect
scope1 = '192.168.3.155'
#Check that TCPIP0 is not actually TCPIP
scope = rm.get_instrument('TCPIP0::'+scope1)
print(scope.query("*IDN?"))
scopeObj = TektronixScope('TCPIP0::192.168.3.155::inst0::INSTR')
X,Y = scopeObj.read_data_one_channel('CH4',t0 =0,DeltaT = 1E-6,x_axis_out=True)
pylab.plot(X,Y)
pylab.show()
And when running this code as is I am facing the following errors:
runfile('C:/Users/sat01/Documents/Python Scripts/Scope Scripts/Scope Capture_r2.py', wdir='C:/Users/sat01/Documents/Python Scripts/Scope Scripts')
TEKTRONIX,MDO3014,C041883,CF:91.1CT FV:v1.24
Traceback (most recent call last):
File "C:\Users\sat01\Documents\Python Scripts\Scope Scripts\Scope Capture_r2.py", line 30, in <module>
X,Y = scopeObj.read_data_one_channel('CH4',t0 =0,DeltaT = 1E-6,x_axis_out=True)
File "C:\Users\sat01\Anaconda3\lib\site-packages\PyTektronixScope\PyTektronixScope.py", line 303, in read_data_one_channel
x_0 = self.get_out_waveform_horizontal_zero()
File "C:\Users\sat01\Anaconda3\lib\site-packages\PyTektronixScope\PyTektronixScope.py", line 260, in get_out_waveform_horizontal_zero
return float(self.ask('WFMO:XZERO?'))
File "C:\Users\sat01\Anaconda3\lib\site-packages\PyTektronixScope\PyTektronixScope.py", line 59, in ask
return self._inst.ask(cmd)
File "C:\Users\sat01\Anaconda3\lib\site-packages\pyvisa\resources\messagebased.py", line 618, in ask
return self.query(message, delay)
File "C:\Users\sat01\Anaconda3\lib\site-packages\pyvisa\resources\messagebased.py", line 613, in query
return self.read()
File "C:\Users\sat01\Anaconda3\lib\site-packages\pyvisa\resources\messagebased.py", line 427, in read
message = self._read_raw().decode(enco)
File "C:\Users\sat01\Anaconda3\lib\site-packages\pyvisa\resources\messagebased.py", line 400, in _read_raw
chunk, status = self.visalib.read(self.session, size)
File "C:\Users\sat01\Anaconda3\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1584, in read
ret = library.viRead(session, buffer, count, byref(return_count))
File "C:\Users\sat01\Anaconda3\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 193, in _return_handler
raise errors.VisaIOError(ret_value)
VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
Many thanks for your efforts
The IDN command is working, so this is not a connection problem. Maybe an error occurs is there is no trace on the scope (i.e. the CH4 is off or the scope was not triggered). This is a guess.
Hi clade, I've resolved part of the issue - I am able to move past the timeout after cycling my system, however I am now encountering an issue regarding reading a specific channel. I am communicating over TCPIP, however it seems that I cannot assign a specific channel name using the TCPIPInstrument object via pyvisa. It seems like PyTetktronixScope is trying to set an attribute for the TCPIPInstrument object that doesn't exist, that is, the channel name. Let me know what you think.
IN: X,Y = scopeObj.read_data_one_channel('CH1',t0=0,DeltaT=1E-6,x_axis_out=True)
C:\Users\sat01\Anaconda3\lib\site-packages\pyvisa\resources\messagebased.py:617: FutureWarning: ask is deprecated and will be removed in 1.10, use query instead.
'1.10, use query instead.', FutureWarning)
Traceback (most recent call last):
File "<ipython-input-21-0fb755b826cc>", line 1, in <module>
X,Y = scopeObj.read_data_one_channel('CH1',t0=0,DeltaT=1E-6,x_axis_out=True)
File "C:\Users\sat01\Anaconda3\lib\site-packages\PyTektronixScope\PyTektronixScope.py", line 322, in read_data_one_channel
is not selectecd"%(str(channel)))
TektronixScopeError: Try to read channel CH1 which is not selectecd
IN: scope.ask('SEL:%s?'%(scope.channel_name(channel)))
Traceback (most recent call last):
File "<ipython-input-23-276991f171b2>", line 1, in <module>
scope.ask('SEL:%s?'%(scope.channel_name(channel)))
AttributeError: 'TCPIPInstrument' object has no attribute 'channel_name'