ni / ni/nimi-python

Error in IVI session options mapping

Open
#2,087 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
128
Forks
110
Avg merge
5d 14h
Merged PRs (30d)
10

Description

Description of issue

In the construction or Session, the dictionary options is processed by a non-public converter object: _converters.convert_init_with_options_dictionary.
This is basically a mapping to convert the keys from the dictionary into other keys suitable for the driver.

The issue is related to the following keys:

  • query_instrument_status, which is not processed because in the converter's mapping it does not exist as is (we have queryinstrstatus or query_instr_status);

  • record_value_coersions, for two reasons

    1. there is a typo in the documented key name (docstring), as it should be record_value_coercions;
    2. in either case, it will never be processed because in the converter's mapping it does not exist as is (we have recordcoercions or record_coercions)
System report

The following error is raised when we pass the query_instrument_status: False option:

Driver error: -1074134965: IVI: The option string parameter contains an entry with an unknown option name/

query_instrument_status.
Steps to reproduce issue
import nidcpower

ivi_session_options = {
    cache=True,
    interchange_check=False,
    query_instrument_status = False,
    range_check=True,
    record_value_coersions = False,
    simulate=True,
}

instrument_session = nidcpower.Session(
    resource_name='PXI1Slot2',
    channels=None,
    reset=True,
    options=ivi_session_options,
    independent_channels=True
)
  1. Prepare one of the faulty option, as described above.
  2. Initialise a Session with the faulty option.
  3. Observe the error.

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

Start at nidcpower.Session and follow its options handling into _converters.convert_init_with_options_dictionary. Inspect the converter mapping and the documented option names for query_instrument_status and record_value_coersions, then reproduce the supplied initialization to verify that the corrected options are accepted without an unknown-option error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.