pyvisa / pyvisa-py

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

type error when closing a usb instrument #271

Closed ercanal closed 4 years ago

ercanal commented 4 years ago

Using pyvisa-py as a backend

>>> import pyvisa
>>> rm=pyvisa.ResourceManager()
>>> a=rm.list_resources()
>>> address=a[1]
>>> print(a[1])
USB0::2907::65488::1813863::0::INSTR
>>> inst=rm.open_resource(address)
>>> inst.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.7/site-packages/pyvisa/resources/resource.py", line 334, in close
    self.visalib.close(self.session)
  File "/home/pi/.local/lib/python3.7/site-packages/pyvisa_py/highlevel.py", line 439, in close
    return self.handle_return_value(session, sess.close())
  File "/home/pi/.local/lib/python3.7/site-packages/pyvisa/highlevel.py", line 247, in handle_return_value
    if rv < 0:
TypeError: '<' not supported between instances of 'NoneType' and 'int'

pyvisa-info

Python: Implementation: CPython Executable: /usr/bin/python3 Version: 3.7.3 Compiler: GCC 8.3.0 Bits: 32bit Build: Dec 20 2019 18:57:59 (#default) Unicode: UCS4

PyVISA Version: 1.11.0

Backends: ivi: Version: 1.11.0 (bundled with PyVISA) Binary library: Not found py: Version: 0.5.0 ASRL INSTR: Available via PySerial (3.4) USB INSTR: Available via PyUSB (1.1.0). Backend: libusb1 USB RAW: Available via PyUSB (1.1.0). Backend: libusb1 TCPIP INSTR: Available TCPIP SOCKET: Available GPIB INSTR: Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of funcionality. No module named 'gpib'

ercanal commented 4 years ago

No error on dev version