question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Resource' object has no attribute 'write'

See original GitHub issue

Hi, 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:closed
  • Created 3 years ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
MatthieuDartiailhcommented, Sep 21, 2020

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).

0reactions
greyltccommented, Sep 25, 2020

Cool, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Drive API: AttributeError: 'Resource' object has no ...
It seems you have recently upgraded your API version from 2 to 3! Per the Drive API changelog, there is no children() resource...
Read more >
AttributeError: 'Resource' object has no attribute 'management ...
In google-api-python-client v4 im getting this error when im trying to get the account summery. analytics ...
Read more >
AttributeError: 'Resource' object has no attribute 'list' I'm getting ...
AttributeError : 'Resource' object has no attribute 'list'. I'm getting an error like this. --. --. More from Jithin James. Follow.
Read more >
google-api-python-client
ID Status Summary 297 Fixed Unresolved reference Type‑Defect Priority‑Medium 295 Started Version 1.2
Read more >
[FIXED] AttributeError: 'NoneType' object has no attribute ...
To handle this error, you can try to rectify the root of the problem by ensuring that the object being referenced is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found