Closed itayperl closed 4 years ago
That is bound to confuse people a lot ! Could you add something in the documentation about it.
Hmm, what do you find confusing here? It feels reasonable to me to skip devices that we are unable to query.
The only thing that is a bit confusing to me is that on Linux ResourceManager.list_resources() returns all connected devices, whereas on Windows it only returns devices that are not already open (that's already the behavior today, not affected by this PR).
I am pretty that some people will report that their device is not detected on Windows and as a consequence Ithink it is worth improving the documentation to mention that caveat. I am fine with your implementation.
But we may want to log the fact that specific instrument could not be accessed and if on windows suggest one possible reason.
I added a note about list_resources - is there any other scenario that should be documented? I don't think we need another log for this case - there's already a warning log here for this failure in list_resources.
My bad I forgot about that warning.
No rush! I'll use my fork in the meantime. Thanks!
@itayperl can you address the conflicts ?
@itayperl can you address the conflicts ?
Done.
bors r+
Build succeeded:
For some reason, PyUSB on Windows is unable to read the serial_number attribute from a device that's already open in another pyusb instance, and crashes with a cryptic "device has no langid" exception when it's accessed.
When a USB resource is opened, PyVISA-py tries to find the device by serial number. If there's already another open device, its serial_number attribute will be accessed in this search, triggering the langid exception.
With this fix we will silently ignore a device when accessing a search attribute on it raises an exception.