"Null address for New Option String" on first creation of Session
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.
~~Accidentally submitted this immediately. I am working on updating the bug contents. Sorry for any inconvenience.~~
Alright, this is ready for review.
Can you try a newer runtime version of NI-DCPower?
NI-DCPower 19.5 is the latest released on 10/25/19.
Also, what device model are you using?
@InvncibiltyCloak any progress on this?