pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
288 stars 124 forks source link

capture the screenshot of Agilent 6000 scope using pyvisa #327

Closed MaximLMC closed 2 years ago

MaximLMC commented 2 years ago

I’m trying tocapture a screenshot of a scope using python pyvisa library but I’m having an issue with read_ raw, “print canceled”

import pyvisa
 import sys
 #
 # Example VISA address for a USB         connection:
 VISA_ADDRESS = 'USB0::0x2A8D::0x1797::CN57046145::0::INSTR'

 scope = pyvisa.ResourceManager('C:\\Windows\\System32\\visa32.dll')

  print (scope.query('*IDN?\n'))
  scope.write('SAVE:IMAG:FILEF PNG')
  scope.write('HARDCOPY START')
  raw_data = scope.read_raw ()
 f= open ('Shot.png' 'wb')
 f.write (raw_data)
 f.close 
MatthieuDartiailh commented 2 years ago

Without your instrument model, manual and a traceback I cannot really help here. Also note that if you expect binary data you should use read_binary_values as otherwise you will stop at the first termination character.

MaximLMC commented 2 years ago

I’m using Agilent and LeCtoy, and my problem is with both, I can Communicate with them, but I can’t get a screen shot of the scope, I get massage of my Agilent scope “ querry uninterrupted ”