Open schlatterbeck opened 9 months ago
I've traced this with tcpdump. The working version (ds2000-shell, a c++ app based on librevisa) does not append '\r\n' to the command sent while pyvisa-py apparently automagically appends '\r\n' to my command. So far I see no further difference in the packets, it seems with carriage-return and newline appended my oscilloscope simply refuses to provide any output.
Note that the timeout error is produced on the oscilloscope side -- the answer returned by the read command contains the error.
Is there a way to turn off the auto-append of '\r\n' in pyvisa-py?
Hypothesis confirmed, my device doesn't like the write_termination
with '\r\n':
>>> import pyvisa
>>> rm = pyvisa.ResourceManager('@py')
>>> inst = rm.open_resource('TCPIP::oszi')
>>> inst.write_termination = ''
>>> inst.query('*IDN?')
'RIGOL TECHNOLOGIES,DS2...,........,........\n'
[Serial number in device output censored]
Now the question is: Is this a bug or a feature? Of pyvisa or of my device?
Maybe the write_termination
should be set to the empty string for TCPIP?
Changing the default is likely to cause more churn than it is worth. I advise to always set explicitly the desired read and write termination.
Thanks for the quick feedback. I guess this should be documented. So far the documentation provided on readthedocs is very brief, I'd put a ref to the write_termination there on the first page (index.rst) with the example mentioning TCP?
I've submitted a pull request #411 for updating the index.rst in the docs.
Opening a TCPIP resource works partially: Some commands can be sent (and have an effect on a Rigol DS2072 oscilloscope) but trying to read anything (e.g. with 'query') produce a timeout. Running a tcpdump in the background sees packets going to and from the device. Even when I specify a long timeout (30s) as second argument to query, I'm still getting a timeout. The name
oszi
is the DNS name of my oscilloscope.To Reproduce
Output of
pyvisa-info