pyvisa / pyvisa-py

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

GPIB interface.command() calls don't seem to work #275

Open greyltc opened 4 years ago

greyltc commented 4 years ago

https://github.com/pyvisa/pyvisa-py/blob/06511146938631a7c8984b5c33405b14bb28a171/pyvisa_py/gpib.py#L450

This doesn't seem to be working with the latest stable release of gpib_ctypes:

ifc.command(b"0x1")
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pyvisa_py/gpib.py", line 450, in gpib_control_ren
    ifc.command(b"0x1")
  File "/usr/lib/python3.8/site-packages/gpib_ctypes/Gpib.py", line 47, in command
    gpib.command(self.id, str)
  File "/usr/lib/python3.8/site-packages/gpib_ctypes/gpib/gpib.py", line 262, in command
    raise GpibError("command")
gpib_ctypes.gpib.gpib.GpibError: command() error: Iberr 4, bad argument to function call

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/gpib_ctypes/Gpib.py", line 47, in command
    gpib.command(self.id, str)
  File "/usr/lib/python3.8/site-packages/gpib_ctypes/gpib/gpib.py", line 262, in command
    raise GpibError("command")
gpib_ctypes.gpib.gpib.GpibError: command() error: Iberr 4, bad argument to function call

I can't seem to find the syntax trick to get gpib_ctypes to accept that command :-(

It also doesn't work with the python bindings for linux-gpib all built from the latest linux-gpib SVN commit:

ifc.command(b"0x1")
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/Gpib.py", line 43, in command
    gpib.command(self.id, str)
gpib.GpibError: cmd() failed: One or more arguments to the function call were invalid.

Maybe the two breakages are related?

MatthieuDartiailh commented 4 years ago

That one is something I added recently and could not test (don't remember if I shouted out to the community for this one....). This is a pretty dumb typo I think it should be:

ifc.command(b"\x01")

276 should fix it. If you can test it would be great.