Open dougthor42 opened 1 year ago
It looks like this applies to tcpip.py
in a couple places too:
These could be TCPIPError
or similar.
Technically those errors should never bubble up to the users. They should be converted to proper return code before getting out of pyvisa-py so typically here https://github.com/pyvisa/pyvisa-py/blob/main/pyvisa_py/highlevel.py#L167
Since they may have fairly different origins for different hardware connection, it may make sense to have a generic exception class providing a method to get a return code for VISA and some logging facility (since we are losing information when converting teh exception to an int). Then each hardware could deal with generating the error based on what may go wrong for this specific hardware.
Would you be interested in working on such a solution ?
Sure I'll take a stab at it. :+1:
Attempting to open a resource to a USB devices that is already in use results in an
Exception
. This is difficult for callers to handle, as the raised error is too broad.Can a different exception be raised here?
https://github.com/pyvisa/pyvisa-py/blob/ceb594bdedab04a21d402739059c752c905b8a79/pyvisa_py/protocols/usbtmc.py#L225
Perhaps a new
USBTMCError
similar to what is done in VXI11?https://github.com/pyvisa/pyvisa-py/blob/ceb594bdedab04a21d402739059c752c905b8a79/pyvisa_py/protocols/vxi11.py#L80-L81
I'd be happy to implement it if you're OK with the suggestion.
To Reproduce
Steps to reproduce the behavior:
pyvisa-py
backend:rm = pyvisa.ResourceManager("@py")
instr = rm.open_resource("USB:: ... ::INSTR")
instr = rm.open_resource("USB:: ... ::INSTR")
Output of
pyvisa-info