I am trying to transfer a screen shot from an Rhode & Schwarz - FSV Signal Analyzer to my PC.
How do I transfer binary block data so that the picture is properly saved onto my PC from the Instrument? My code is below. A file gets saved to my desktop, but my computer throws an error and cannot open because the file is not formatted correctly.
import visa
rm = visa.ResourceManager()
inst = rm.open_resource('TCPIP0::178.168.48.31::inst0::INSTR')
inst.write("mmem:name 'C:\eswScreen.wmf\'")
inst.write("MMEM:DATA? 'C:\eswScreen.wmf\'")
img = inst.read_raw()
target = open(r"C:\Users\myName\Desktop\screenShot.wmf", 'wb')
target.write(img)
target.close()
Error when trying to open file on Desktop
I verified the screen shot is saved on the instrument. Also verified with another instrument that the SCPI syntax is correct. So it must be how the binblock data is being transferred. Any advice is greatly appreciated.