08-14-2007 06:59 PM
08-15-2007 03:13 PM
National Instruments has not tested our drivers in the Python environment, and does not officially support Python. Other users have had success getting drivers working in unsupported environments before, and hopefully they can give some assistance. I may also suggest posting on the LAVA forums, which is an active LabVIEW community.
Regards,08-16-2007 05:22 PM
As you might have already realized, you could use the actual numeric value which is represented by NISCOPE_VAL_NORMAL - remember that #define is a compiler directive to substitute the literal with whatever value compiler encounters on that line, so the compiled niscope_32.dll will certainly not know anything about the string literal NISCOPE_VAL_NORMAL (which is defined as IVISCOPE_VAL_NORMAL which is defined as 0, just FYI).
@snelltaylor wrote:
Hi, I'm trying to use ctypes in Python to import the NI-SCOPE_32.DLL and interface with a 5105 and 5124.
So far, I have successfully (I think) created a new session with the 5124. I can't do anything else as trying to access any constants results in an error such as "AtrributeError: function 'NISCOPE_VAL_NORMAL' not found" when trying to access any of these constants. I can look in the niscope.h file and see that they are #defined, but it seems the compiled DLL doesn't contain these definitions, or I can't access them for some reasons. Has anybody got this to work correctly or have any advice?
08-16-2007 05:43 PM
08-17-2007 10:06 AM
@snelltaylor wrote:
Thanks for the input. I had been looking for the #define's in the headers, and found them, but the definitions were just to other strings - such as IVISCOPE_VAL_NORMAL.
Where would I go about finding what the values these represent are? Do I just have to chase them down through the headers?
Also, what kind of value should I be getting back from the niScope_init function? Right now, it gives a return value of -10something, maybe 5 or 6 digits, but the viSession pointer (which I pass using ctypes.byref()) ends up with a value of 0. The two booleans that are passed were just Python's False, so the function call looked like:
import ctypes
scope = ctypes.cdll.niscope_32
viSession = ctypes.c_long() #do I need a value here for an actual variable rather than null?
scope.niScope_init("PXI2::13::INSTR",False,False,ctypes.byref(viSession))
Does this seem reasonable? Am I missing something big here?
Thanks,
Sean
08-17-2007 03:23 PM
08-20-2007 02:13 PM
08-20-2007 04:16 PM
08-24-2007 02:02 PM
So, it appears that it's not really the issue in viConstString (at least I am not seeing it for niScope_ConfigureVertical function) As you might have discovered, viConstString is const char *, and Python should not have problems with this.
@snelltaylor wrote:
To reply to my own post (since I couldn't find any option to edit), it seems any function I try to use doesn't like the viConstString channelList. Whatever integer I put in for the channel shows up as hex in the previous posted error. What value should I be putting there?
Thanks,
Sean