alsterane / pylibnidaqmx

Automatically exported from code.google.com/p/pylibnidaqmx
Other
0 stars 0 forks source link

Import nidaqmx fails on Windows XP 32 #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On Windows XP 32, doing 'import nidaqmx' fails (using trunk as of Feb 24th)

You get the following traceback:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\<ipython console> in <module>()

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\__init__.py in <module>()
     52 that should plot two sine waves.
     53 """
     54
     55
---> 56 from .libnidaqmx import AnalogInputTask, AnalogOutputTask,
DigitalInputT
ask, DigitalOutputTask, CounterInputTask, CounterOutputTask

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in <module>()
     80 if libnidaqmx is not None:
     81
---> 82     nidaqmx_version = get_nidaqmx_version()
     83     nidaqmx_h_name = 'nidaqmx_h_%s' % (nidaqmx_version.replace
('.', '_'
))
     84

C:\DOCUME~1\tester\MYDOCU~1\SMSC\nidaqmx\nidaqmx\libnidaqmx.py in
get_nidaqmx_ve
rsion()
     72         return None
     73     d = uInt32 (0)
---> 74     libnidaqmx.DAQmxGetSysNIDAQMajorVersion(ctypes.byref(d))
     75     major = d.value
     76     libnidaqmx.DAQmxGetSysNIDAQMinorVersion(ctypes.byref(d))

ValueError: Procedure called with not enough arguments (4 bytes missing) or
wrong calling convention

The problem is that on Windows most DAQmx calls use the windll calling
convention.  Replacing the definition of libnidaqmx with

else:
    if os.name=='nt':
        libnidaqmx = ctypes.windll.LoadLibrary(lib)
    else:
        libnidaqmx = ctypes.cdll.LoadLibrary(lib)

resolves the problem.

Original issue reported on code.google.com by cwebster...@gtempaccount.com on 25 Feb 2010 at 3:42

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r27.

Original comment by pearu.peterson on 26 Feb 2010 at 8:12