LabPy / lantz

Lantz is an automation and instrumentation toolkit with a clean, well-designed and consistent interface. It provides a core of commonly used functionalities for building applications that communicate with scientific instruments allowing rapid application prototyping, development and testing. Lantz benefits from Python’s extensive library flexibility as a glue language to wrap existing drivers and DLLs.
http://lantz.readthedocs.org/
Other
134 stars 65 forks source link

timeout and the TCPDriver #42

Open gdavis-xilinx opened 9 years ago

gdavis-xilinx commented 9 years ago

If I use an instrument 'inst' with the TCPDriver, inst.query('misspelled command') hangs.

The inst.TIMEOUT is not effective because the socket is blocking by default.

Would the proper thing to do be to:

I'm not sure which approach is more Lantz-ish. I could do a PR if modifying a Lantz class is advised.

hgrecco commented 9 years ago

Anyway, in Lantz 0.3 (currently in develop and to be released tomorrow, yeah!) the TCPDriver is replaced by the MessageBasedDriver. The MessageBasedDriver uses PyVISA under the hood as a frontend to many backends. NI-VISA is one, but pyvisa-py is another one which has a TCPDriver like class.

So if you cannot used NI-VISA, the more Lantz-ish (I like that!) will be to make pyvisa-py respect the timeout (Actually it implements it but has not been throughly tested).

Let me know if you need assistance.