Posted Mon, 22 May 2023 20:51:50 GMT by Li, Xiang
FILESYSTEM:READFILE “E:/test_data/tek00016CH1.csv” reads the<br> content of the specified file, if the file exists and is readable, and sends the content<br> of the file to the current interface.<br> <br> Question about the above content in the programmers' manual, after&#160;FILESYSTEM:READFILE “E:/test_data/tek00016CH1.csv”, how do I read this file from&#160;the current interface?<br> <br> I've worked with images (using &quot;read_raw&quot;) before using the below snippets but what's the cmd for WFM/CSV files?&#160;<br> <br> &#160; <pre>self.write(f'FILESystem:READFile \&quot;C:/{name}.png\&quot;') sleep(0.2) imgData = self.inst.read_raw(640 * 480)</pre>
Posted Mon, 22 May 2023 22:14:13 GMT by Teles, Afonso
Hi Xiang,<br> <br> If you're using pyvisa, you can just use <code>read_raw()</code> with no arguments and it will automatically read the whole file and stop, there's no need to set the number of bytes to read.<br> And in fact the argument to <code>read_raw()</code> isn't the number of bytes to read, it's the chunk size to do that reading in, different things, as documented here: <a href="https://pyvisa.readthedocs.io/en/latest/api/resources.html#pyvisa.resources.SerialInstrument.read_raw">https://pyvisa.readthedocs.io/en/latest/api/resources.html#pyvisa.resources.SerialInstrument.read_raw</a>

You must be signed in to post in this forum.