pyvisa / pyvisa-py

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

USB: fix error with infinite timeout in interface #166

Closed mgubser closed 6 years ago

mgubser commented 6 years ago

If on self.interface the timeout is never set or explicitly set to None this function will raise an exception on line 77 (TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'). Therefore I suggest this change, which was probably the intent of the author.

MatthieuDartiailh commented 6 years ago

Thanks for catching this. However it turns out the proposed fix is not the correct one. When the timeout of the USB interface is set to None it will use the default timeout of pyusb which is not what we want. The proper fix is to make sure we pass the expected timeout to pyusb when creating the interface, which was not what was happening. I implemented the proper fix in a new pull request. However since I do not have the hardware required to test currently I would appreciate if you could test it.