microsoft / microsoft/Qcodes

Silent Failure when creating a simulated instrument with the wrong address

Open
#988 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
459
Forks
359
Avg merge
3d 6h
Merged PRs (30d)
73

Description

This is not actually a qcodes issue but we might be able to find a workaround.
When creating a simulated instrument and then trying to connect to it on a different address than specified the error created in the visa lib does not get looped through.

If there is a mismatch in the address the session object will be a mismatch:
https://github.com/pyvisa/pyvisa-sim/blob/9836166b6b57c165fc63a276f87fe81f106a4e26/pyvisa-sim/highlevel.py#L205
This is caught and returned properly, but never gets handled, the code from the cited line is:

 try:
            sess = self.sessions[session]
        except KeyError:
            return constants.StatusCode.error_invalid_object

        try:
            return sess.write(data)
        except AttributeError:
return constants.StatusCode.error_nonsupported_operation

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read pyvisa-sim/highlevel.py around line 205, then trace Qcodes' simulated-instrument connection and write path. Reproduce an address mismatch and follow the returned status code to locate where it is dropped. Done means the mismatch no longer fails silently and an appropriate error is observable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.