'Resource' object has no attribute 'write'
See original GitHub issueHi, I’ve just updated to the latest version of pyvisa and now get the following error:
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvisa
>>> rm = pyvisa.ResourceManager()
>>> rm.list_resources()
('ASRLCOM3::INSTR', 'ASRLCOM4::INSTR')
>>> my_instrument = rm.open_resource('ASRLCOM3::INSTR')
>>> print(my_instrument.query('*IDN?'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Resource' object has no attribute 'query'
I’ve noted this unusual output:
>>> print(my_instrument)
Resource at ASRLCOM3::INSTR
expected behaviour on readthedocs is along the lines of:
<GPIBInstrument('GPIB::14')>
pyvisa-info PS C:\Users\mainuser\Documents\Python\sm1800> pyvisa-info Machine Details: Platform ID: Windows-10-10.0.19041-SP0 Processor: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
Python: Implementation: CPython Executable: c:\users\mainuser\appdata\local\programs\python\python38\python.exe Version: 3.8.3 Compiler: MSC v.1924 64 bit (AMD64) Bits: 64bit Build: May 13 2020 22:37:02 (#tags/v3.8.3:6f8c832) 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: Please install PyUSB to use this resource type. No module named ‘usb’ USB RAW: Please install PyUSB to use this resource type. No module named ‘usb’ 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’
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (12 by maintainers)
Top GitHub Comments
I would start by having a look at https://github.com/pyvisa/pyvisa-py/blob/master/pyvisa_py/serial.py#L69 (where you would need to cleanup the output of pyserial) and https://github.com/pyvisa/pyvisa-py/blob/master/pyvisa_py/serial.py#L84 (where we need to add back COM to the port I assume, but I do not have a system to test).
Cool, thanks!