"Null address for New Option String" on first creation of Session
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 128
- Forks
- 110
- Avg merge
- 5d 14h
- Merged PRs (30d)
- 10
Description
Description of issue
In my script, I first initialize another library, which depends on ctypes to load a dll. Everything runs fine for the other library.
Then, any time I try and initialize an nidcpower.Session object after that, I get the DriverError ("Null Address for New Option String") shown below.
This error only appears the first time the script is run for each reboot of the computer. Each time after that, the Session object initializes just fine. Also, if I change the order to initialize the other library after creating a Session object, everything works fine.
If I had to guess, there is some ctypes string buffer object not being initialized properly by the nidcpower library. Then this uninitialized string buffer is passed as the option string to the nidcpower C dll.
Error Trace from Python:
File "E:\17E0923_Servocontrol_Rev_NEW\pydcpower\pydcpower.py", line 18, in __init__
self.s = nidcpower.Session(resource_name=self.RESOURCE_NAME, channels=str(channels), reset=True)
File "E:\17E0923_Servocontrol_Rev_NEW\env\lib\site-packages\nidcpower\session.py", line 3739, in __init__
self._vi = self._initialize_with_channels(resource_name, channels, reset, options)
File "E:\17E0923_Servocontrol_Rev_NEW\env\lib\site-packages\nidcpower\session.py", line 4620, in _initialize_with_channels
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
File "E:\17E0923_Servocontrol_Rev_NEW\env\lib\site-packages\nidcpower\errors.py", line 95, in handle_error
raise DriverError(code, description)
nidcpower.errors.DriverError: -1074135025: IVI: (Hex 0xBFFA000F) Invalid parameter.
Null address for New Option String
System report
OS:
Name: Windows
Version: 6.1.7601
Bits: 64
Driver:
Name: NI-DCPower
Version: 17.1.0.49153
Module:
Name: nidcpower
Version: 1.1.3
Python:
Version: 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit
(Intel)]
Bits: 32
Is_Venv: True
Installed Packages:
six==1.13.0
simple-pid==0.2.4
setuptools==28.8.0
pywin32-ctypes==0.2.0
pyqtchart==5.13.1
pyqt5==5.13.2
pyqt5-sip==12.7.0
pyinstaller==3.5
pip==19.3.1
pefile==2019.4.18
numpy==1.17.3
nidcpower==1.1.3
nidaqmx==0.5.7
markupsafe==1.1.1
jinja2==2.10.3
future==0.18.2
altgraph==0.16.1
Steps to reproduce issue
Example script:
from ctypes import windll
import nidcpower
lib = windll.LoadLibrary('C:\\Program Files (x86)\\North Atlantic Industries\\NAI_CPCI75C3_VISA\\Lib\\Win32\\Release\\CPCI75C3Dll.dll')
lib.CPCI75C3_Init()
s = nidcpower.Session(resource_name='PXI1Slot3', channels=str(0), reset=True) # Error thrown here
Steps to reproduce:
1. Initialize any ctypes dll.
2. Initialize a Session object.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ctypes DLL load and the nidcpower.Session call in the reproduction script, then inspect nidcpower/session.py at _initialize_with_channels and nidcpower/errors.py at handle_error. Reproduce the failure after loading the DLL and verify that Session initializes successfully without the "Null address for New Option String" error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100