tkrebes / nisyscfg-python

NI System Configuration Python API
MIT License
4 stars 0 forks source link

how to use nisyscfg PY API to read version of NI-DAQmx Device Driver? #36

Closed nahumpodokshik closed 1 year ago

tkrebes commented 2 years ago

On Windows, you can use get_installed_software_components.

import nisyscfg
with nisyscfg.Session() as session:
    for component in session.get_installed_software_components():
        if component.id == 'ni-daqmx-runtime-core':
            print(component.title, component.version)

Output: NI-DAQmx Runtime 20.1.0.49152-0+f0

ID Title Details
ni-daqmx NI-DAQmx This is the top-level package of NI-DAQmx. Use this to get the version listed in NI Package Manager.
ni-daqmx-runtime-core NI-DAQmx Runtime In NI MAX, this is the NI-DAQmx Device Driver.
ni-daqmx-config-support-core NI-DAQmx Runtime with Configuration Support In NI MAX, this is the NI-DAQmx MAX Configuration.
ni-daqmx-development-support NI-DAQmx Application Development Environment Support (Legacy) In NI MAX, this is the NI-DAQmx ADE Support (requires item_types=ALL_VISIBLE_AND_HIDDEN to be listed). Though, this is not as useful as of visible components such as ni-daqmx-labview-2020-support-x86, NI-DAQmx Support for LabVIEW 2020 (32-bit) which give the actual version of support for a given ADE.
nahumpodokshik commented 2 years ago

i received the following error: image

nahumpodokshik commented 2 years ago

pip show nisyscfg Name: nisyscfg Version: 0.0.4 Summary: NI System Configuration Python API Home-page: https://github.com/tkrebes/nisyscfg-python Author: National Instruments Author-email: None License: MIT Location: c:\python38\lib\site-packages Requires: hightime, six Required-by:

nahumpodokshik commented 2 years ago

property ID is not filtering provides "ni-daqmx-runtime-core" I replaced property ID to TITLE and received the Output: import nisyscfg with nisyscfg.Session() as session: for component in session.get_installed_software_components(): if component.title == 'NI-DAQmx Runtime 18.5': print(component.title, component.version, component.details, component.id)

Output: NI-DAQmx Runtime 18.5 18.50.49155 Run-time components required to deploy applications using National Instruments data acquisition devices. {000056C0-A9B8-4A59-A457-1A2DEED287C7}

i printed all detected "component.title" and don't see "NI-DAQmx" separated:

Microsoft Silverlight 5.1 NI 1588-2008 Network Management Runtime 18.1.0 NI Device Monitor 17.0 NI I/O Trace 18.5 NI LabVIEW Runtime 2014 SP1 f11 NI LabVIEW Runtime 2016 f6 NI LabVIEW Runtime 2016 f7 (64-bit) NI LabVIEW Runtime 2017 SP1 f3 NI LabWindows/CVI Shared Runtime 2017 NI Launcher NI License Manager NI Measurement & Automation Explorer 18.5 NI Measurement Studio Common .NET Language Assemblies for the .NET Framework NI Measurement Studio Common .NET Language Runtime 17.5 for .NET 4.0 NI Measurement Studio Network Variable .NET Language Runtime 2015 for .NET 4.5 NI Measurement Studio UI .NET Language Runtime 2015 for .NET 4.5 NI PXI Platform Services Configuration 18.5 NI PXI Platform Services Runtime 18.5 NI System Configuration .NET Runtime for .NET Framework 4.6 NI System Configuration Runtime 18.5.0 NI System Web Server 2019 NI TDM Excel Add-In NI USI 15.0.2 NI Variable Engine 2017 NI Web-Based Configuration and Monitoring 18.0 NI-488.2 Configuration Support 18.5 NI-488.2 Development Support NI-488.2 Runtime 18.5 NI-DAQmx .NET 18.5 for .NET Framework NI-DAQmx .NET Language Runtime 18.5 for .NET Framework 4.0 NI-DAQmx Application Development Support 18.5 NI-DAQmx Runtime 18.5 NI-DAQmx Runtime with Configuration Support 18.5 NI-VISA .NET Development Support NI-VISA .NET Runtime 17.5 NI-VISA C Examples NI-VISA Configuration Support 18.5 NI-VISA Driver Development Wizard NI-VISA Meta Package NI-VISA Remote Server 18.5 NI-VISA Runtime 18.5

nahumpodokshik commented 2 years ago

the second issue, the code is running for local Session only. if use remote, like the following, code crashed with nisyscfg.Session(target=host) as session: for component in session.get_installed_software_components(): print(component.title, component.version, component.details)

error log: line 29, in print…. for component in session.get_installed_software_components(): File "C:\Python38\lib\site-packages\nisyscfg\system.py", line 576, in get_installed_software_components nisyscfg.errors.handle_error(self, error_code) File "C:\Python38\lib\site-packages\nisyscfg\errors.py", line 85, in handle_error raise LibraryError(status, description) nisyscfg.errors.LibraryError: Status.FAIL: Miscellaneous operation failure.

Process finished with exit code 1

tkrebes commented 2 years ago

i printed all detected "component.title" and don't see "NI-DAQmx" separated:

The NI-DAQmx package was created as part of the 19.0 release in which installers were updated to be installed via NI Package Manager. Since, NI-DAQmx 18.5 is installed on the system, you will not see a NI-DAQmx component installed. Also before 19.0, the installers IDs will be GUIDs instead of package names.

tkrebes commented 2 years ago

the second issue, the code is running for local Session only. if use remote, like the following, code crashed with nisyscfg.Session(target=host) as session: for component in session.get_installed_software_components(): print(component.title, component.version, component.details)

It is possible that this API is not support by the remote target, or that the target supports Get Installed Software Set. The latter is not implemented in the nisyscfg Python API as feature has not been requested. What type of machine is the host? (such as hardware, OS, software versions, etc.)

nahumpodokshik commented 2 years ago

The host is the same Windows computer directly connected to NI chassis and runs NI SW: Microsoft Silverlight 5.1 5.17.49152 NI Device Monitor 17.0 17.00.49152 NI I/O Trace 18.5 18.50.49152 NI LabVIEW Runtime 2014 SP1 f11 14.2.1 NI LabVIEW Runtime 2016 f6 16.5.1 NI LabVIEW Runtime 2016 f7 (64-bit) 16.6.7 NI LabVIEW Runtime 2017 SP1 f3 17.5.1 NI Launcher 18.01.49152 NI License Manager 4.2 NI Measurement & Automation Explorer 18.5 18.50.49152 NI Measurement Studio Common .NET Language Assemblies for the .NET Framework 17.50.49152 NI Measurement Studio Common .NET Language Runtime 17.5 for .NET 4.0 17.50.49152 NI Measurement Studio Network Variable .NET Language Runtime 2015 for .NET 4.5 17.00.49153 NI Measurement Studio UI .NET Language Runtime 2015 for .NET 4.5 17.00.49153 NI PXI Platform Services Configuration 18.5 18.50.49154 NI PXI Platform Services Runtime 18.5 18.50.49154 NI System Configuration Runtime 18.5.0 18.5 NI System Web Server 2019 19.0 NI TDM Excel Add-In 18.0 NI USI 15.0.2 15.0.26343 NI Variable Engine 2017 17.0 NI Web-Based Configuration and Monitoring 18.0 18.0 NI-DAQmx .NET 18.5 for .NET Framework 18.5 NI-DAQmx .NET Language Runtime 18.5 for .NET Framework 4.0 18.5 NI-DAQmx Application Development Support 18.5 18.50.49155 NI-DAQmx Runtime 18.5 18.50.49155 NI-DAQmx Runtime with Configuration Support 18.5 18.50.49155