RsInstrument icon indicating copy to clipboard operation
RsInstrument copied to clipboard

ValueError: invalid literal for int() with base 10 when trying to get trace.csv

Open banderlog opened this issue 9 months ago • 4 comments

Hi, when I am trying to get CSV with trace, I get next error:

from RsInstrument import *

instr = RsInstrument('TCPIP::169.254.61.50::5555::SOCKET', True, False, "SelectVisa='socket'")
print(instr.query('MMEM:FILE? "PR100/Trace_000.csv"'))
ValueError: invalid literal for int() with base 10: '.4\r\n86705000,4.6\r\n86710000,6.1\r\n86715000,5.8\r\n86720000,5.0\r\n86725000,6.3\r\n86730000,6.1\r\n86735000,5.4\r\n86740000,6.1\r\n86745000,6.6\r\n86750000,5.0\r\n86755000,4.8\r\n86760000,4.9\r\n8

All OK, while using telnet

banderlog avatar Nov 23 '23 14:11 banderlog

Hi banderlog,

is the instrument PR100? Can you post the csv file here? It seems the content has the termination characters used for the message control. Do you need to explicitly use the SOCKET connection?

BR Milo

Miloslav-RS avatar Dec 01 '23 15:12 Miloslav-RS

Hi, @Miloslav-RS

is the instrument PR100?

Yep, PR100.

Can you post the csv file here?

Yes, I'll add it to attach Trace_000.csv

Do you need to explicitly use the SOCKET connection? Unfortunally, I am connected to PR100 not directly, but vie some LAN network. When I try to use VISA it throws Exception.

And rs VISA has it's own problems: with rs VISA and directly connected PR200 I am unable to instr.query_bin_block('MMEM:DATA? "messages"'), but with SOCKET all works

Btw, if it throws any exception, I need to reconnect to device, or I will continue to have strange exceptions on the every next commands.

banderlog avatar Dec 02 '23 08:12 banderlog

I see the problem... the payload contains the CRLF combinations, but the termination character for transmission is set to LF. The transfer is interrupted by the first LF occurrence, the rest of the payload stays in output buffer and is returned in further command queries. I'm affraid there is no solution to get this working correctly in with the RsInstrument. I wonder, how do you get this to work in TELNET? You also have to specify the termination character, or wait for a timeout...

Miloslav-RS avatar Dec 13 '23 06:12 Miloslav-RS

I wonder, how do you get this to work in TELNET?

Just run the command MMEM:FILE? "PR100/Trace_000.csv"

banderlog avatar Dec 13 '23 17:12 banderlog