Skip to content

Can't run consecutive queries without delay in between #3

Open
@larrye11ison

Description

@larrye11ison

Before I get started... I seem to have this same kind of problem with other GPIB solutions. For example, I've built a few arduino-based AR-488 GPIB adapters and had problems just like this. So I'm not really convinced that there is a problem with your code. But I thought maybe you had some knowledge about what may be going on here, and/or if I'm doing things wrong, perhaps you would be willing to help me out. And if that's the case, perhaps we could improve the docs just a bit!

Using your library, I can connect to my prologix ethernet adapter and execute a single command or single query just fine. But if I try and execute two queries one right after the other, I get an error like this:

  File "./test-python-prologix-interface.py", line 21, in <module>
    print("Auto: " + gpib.query('++auto'))
  File "/usr/local/lib/python3.7/dist-packages/plx_gpib_ethernet/plx_gpib_ethernet.py", line 36, in query
    return self.read(buffer_size)
  File "/usr/local/lib/python3.7/dist-packages/plx_gpib_ethernet/plx_gpib_ethernet.py", line 32, in read
    return self._recv(num_bytes)
  File "/usr/local/lib/python3.7/dist-packages/plx_gpib_ethernet/plx_gpib_ethernet.py", line 43, in _recv
    value = self.socket.recv(byte_num)
socket.timeout: timed out

Below is the code I'm using - if I run it as shown, I get the error above. But if I uncomment the sleep() call, then it works. Is that normal?

import time
gpib = PrologixGPIBEthernet('prologix-gpib', timeout=1)
gpib.connect()
print("Ver: " + gpib.query('++ver'))
#time.sleep(.1)
print("Auto? " + gpib.query('++auto'))
gpib.close()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions