gpt4 book ai didi

python - PyVISA 超时错误

转载 作者:太空宇宙 更新时间:2023-11-04 05:33:47 60 4
gpt4 key购买 nike

我正在尝试将示波器文件从 Tektronix 传输到 PC。不幸的是,我不断收到超时错误。我的写作工作但在阅读原始格式时我被卡住了。这是我的代码:

import visa
import time

scope = visa.ResourceManager()
tek = scope.open_resource('GPIB::1::INSTR')
tek.timeout=100000 # timeout 100s
print(tek.query('*IDN?'))
tek.write('FILESYSTEM:FRINT "C:\EDIR\EDIR_812\140mV.png", GPIB')

time.sleep(6)
data = tek.read_raw()
time.sleep(6)


fid = open('C:/Users/svpxi01/Desktop/GPIB read/my_image.png', 'wb')
fid.write(data)
fid.close()
tek.close()
print('Done')

和调试日志:

    TEKTRONIX,TDS5034B,B052776,CF:91.1CT FV:2.0.11

2016-03-29 17:28:38,119 - pyvisa - DEBUG - viWrite(60710720, b'FILESYSTEM:FRINT "C:\\EDIR\\EDIR_812`mV.png", GPIB\r\n', 50, 'c_ulong(50)') -> 0
2016-03-29 17:28:44,130 - pyvisa - DEBUG - GPIB::1::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2016-03-29 17:30:58,366 - pyvisa - DEBUG - viRead(60710720, <ctypes.c_char_Array_20480 object at 0x0389FF30>, 20480, 'c_ulong(0)') -> -1073807339
2016-03-29 17:30:58,406 - pyvisa - DEBUG - GPIB::1::INSTR - exception while reading: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
Traceback (most recent call last):
File "C:\Users\SyedM03\python\tekwrite.py", line 20, in <module>
data = tek.read_raw()
File "C:\Python34\lib\site-packages\pyvisa\resources\messagebased.py", line 306, in read_raw
chunk, status = self.visalib.read(self.session, size)
File "C:\Python34\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1582, in read
ret = library.viRead(session, buffer, count, byref(return_count))
File "C:\Python34\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.

最佳答案

找到我的问题。

tek.write('FILESYSTEM:FRINT "C:\EDIR\EDIR_812\140mV.png", GPIB')

不正确。应该是

tek.write('FILESYSTEM:FRINT "C:/EDIR/EDIR_812/140mV.png", GPIB')

关于python - PyVISA 超时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36297617/

60 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com