Python or mssql in labview

I write everything in LABVIEW instead of python or SQL?

for example.

python code

Conn = _mssql.connect (server ='* ',)
data base = "mydatabase")

can only be translated to LABVIEW?

This is what it looks like with the database connectivity toolkit.

I use connectionstrings.com to get the connection strings for different data sources.

Tags: NI Software

Similar Questions

  • Python, call DLLs in LabVIEW: Fatal internal error when accessing output String Cluster

    Hello

    We have compiled a DLL in LabVIEW (TestError.dll) and tried to call it from Python.

    TestError.dll includes 2 functions:

    1 testErreur: cluster 1 entry string, 1 channel indicator

    2 TestError2: 1 channel input, 1 bunch of output string

    What we try to do in Python is actually something like this:

    1 provide values to controls in the functions of the DLL.

    2. call the DLL.

    3 get the values of the indicators.

    What we have seen are:

    1 read/write operations on normal data types (string, digital) indicators/controls are OK

    2. write operation on the Cluster string entry is OK

    3. read operation on the Cluster output string is not OK. The following error is still prompted for:

    «Unrecoverable internal error: 'MemoryManager.cpp', line 437.» LabVIEW version 8.6... »

    Also joined the TestError.prj and python code.

    Grateful if someone can help to explain why we get this error and how to overcome?

    Thank you

    howmean

    What we have seen are:

    1 read/write operations on normal data types (string, digital) indicators/controls are OK

    2. write operation on the Cluster string entry is OK

    3. read operation on the Cluster output string is not OK. The following error is still prompted for:

    «Unrecoverable internal error: 'MemoryManager.cpp', line 437.» LabVIEW version 8.6... »

    Also joined the TestError.prj and python code.

    It is very logical that it does not, and the bad news is, it cannot really be implemented reliable of a process not LabVIEW.

    LabVIEW channels (and tables) are very specific species. They are then called handles, which are pointers to a pointer to a block of memory. If you have a control or indicator on its own, the Prototype configuration allows you to configure this setting as a C. LabVIEW data pointer, when creating the DLL, create heels C for each exported function and place the code to do the translation between the past C pointer to and necessary LabVIEW data handle. For strings and arrays within the cluster, there is no configuration option and the DLL is expected to pass a structure with data handles native LabVIEW in there.

    You may say that creating handles data in your calling process enough to trick LabVIEW. For the input variables that actually CAN sometimes work (but is a delicate and dangerous generally to handle this). There is no way to make it work for output variables. LabVIEW will try to resize handle to fill data in that he wants to make. This resizing is done using internal memory manager of LabVIEW. This will work only if it had been allocated by EXACTLY the same instance of the memory manager. Otherwise, it refers to a different memory segment and catastophally fail. The only way to make this work perhaps, with luck, taking your heart and prayer to the gods, is to lvrt.dll to allocate a handle that you must pass to the DLL. Still find the good lvrt.dll, which will execute your DLL LabVIEW is a major challenge.

  • Leaks memory database Toolbox

    I have leaks memory in my Labview application linking and insertion of data in a Server MSSQL using Labview Database Toolkit.

    Versions: Labview 7.1, Toolkit 1.0.1.

    I searched the forums and searhed all over elsewhere... In my view, that there are some problems. (For example the list tables vi). Removal from the list of tables vi helped a lot. But I see that I'm losing memory here and there, from time to time.

    My question is: Y at - he of the General guidelines to avoid any leaks memory mentioned?

    Or maybe, all that will disappear if I update versions. (If I understand correctly I've also updated of Labview to be able to update the Toolbox?)

    Best regards

    / Jesper

    There is a small amount of memory allocated whenever you make an 'open '. If you open repetedly who could explaing a small slow leak. The workaround is to open once and re - use ref. Closed only when you encounter an error or are done.

    Ben

  • Use VirtualBench API without LabVIEW. Example: Python, dll, etc.

    Hello

    I would like to know if there is a way to use the API VirtualBench without LabVIEW?

    As the use of python or something.

    Thank you

    We just released version 1.1 of VirtualBench that adds a C API and a bunch of other features, see http://forums.ni.com/t5/VirtualBench/Announcing-free-firmware-update-version-1-1-adds-SPI-and-I2C/td....  With whom you could use VirtualBench in your programming language of choice if you write the appropriate links.

  • Python client for the received string of the server TCP Labview unflatten

    How do decode you, unzip a string flattened in Python which was sent by a LabVIEW TCP server?

    I want to Exchange data via loopback. That's why I take a sine wave and flatten it to string and sent on the network through ServerSine.vi. So I have to decode the incoming data in a way that I have good numerical values as when I draw in LabVIEW. I did so far in python_client.py, but the values are wrong.

    Does anyone know how to decode this correctly?


  • When to use c / python instead of LabVIEW

    I was recently asked when you use python/c and not of LabVIEW.

    As someone who has worked with LabVIEW Kool for awhile I found difficult to answer as it seems to be very few restrictions to what labVIEW can achieve.

    LabVIEW is obviously ideal for test of manufacturing, control systems, rapid prototyping systems, develop ideas, and I even used to generate executables to decrypt the data of wireshark, editing MySQL databases, programs of encryption, etc..

    However, in my head at the following spring to mind that could impose a project to lean towards python.

    1 development license (free vs. paid)

    2 drive - engine labVIEW run requires a lot of space

    3 MCU / smart phones, in particular, could benefit from C / python / Java supported

    Recently, I worked in a company where all R & D product development and manufacturing was done through LabVIEW but regression testing has been done through python. Truth is, I probably could have implemented the regression test in LabVIEW but generally those working environments hose int will use PHP / Python or similar and it is easier to hire a team on that basis.

    I do not putting down LabVIEW rather try to honestly answer a customer's question.  Any OE ideas to answer the question?

    I think I can put it the way the shortest is: LabVIEW is best suited to the intervention of material.

    Yes, you can write a small application of office in LabVIEW... but the obligation to install the runtime (which can be quite slow), it is difficult to create a 'portable' application (there are a lot of workarounds... but still). I don't see why even a simple "Hello World" executable should force hundreds of MB of installation.

    I saw a lot of posts here who have spoken of creating applications to manage data in a database (for example a stock inventory system), or run an executable LabVIEW on a server to act as a server web - Yes, you can use LabVIEW to do these things, but there are other tools that seem much more appropriate (e.g. Apache/IIS and PHP/ASP) - essentially a nice web front end - I also have the same feeling about creating something to review test data - I think that this must be done in a more suitable tool (e.g. a web front end so anyone can access it without the need of RTÉ).

    The cost of the development license is there, Yes (but not for deployment) but it is easier to justify when it is just a small part of a test/measurement system expensive. I also don't really think that the use of the disc is so important nowadays with space being so cheap HARD drive to.

    I feel LabVIEWs strengths are its ability to allow no computer to write their own code to run tests (for example a DAQ in LabVIEW System prototyping takes minutes... how long take in C if you had never used before C?) for new users and allow advanced users (LabVIEW Professional) to create test/measure/search systems much more quickly they could start from scratch in C etc.

  • Opening files Labview using Python

    I was wondering if anyone knows a way to open a file of many windows and Labview project it using a language like Python script. At the present time, I have to open the project file and then manually open several screws connected to this project file and each of them on their correct screens. I am looking for a way to double-click a file on the desktop and have all the open files and go on their respective screens and be ready to go once I press the Start button. Is this possible?

    You end up with open screws that are not "in a project. Simply open screws you can, however, use the same technique to open the project as being the first thing and then open the EIS. If they are in the open project, they appear as part of the project. If they are not in the project, LabVIEW will want to add them to the project.

    Rob

  • The appeal of LabVIEW VI of Python

    Hi Ppl,

    I'm calling python LabVIEW VI using LabVIEW ActiveX or the LabVIEW run engine of ActiveX that can be enabled in the advanced options of the application builder.

    The problem that I am facing is: I use the VirtualInstrument.Call () method to run VI and pass parameters to and from the VI's. When you use this method, I am able to pass arguments to simple controls easily tables e.g., Boolean numerics

    However when I tried to transfer data to a cluster as in the attachment data 1. jpg in this form I get errors:

    Python code:

    ...

    ...

    #Parameters

    Channel_1 = [1,2,3]

    Channel_2 = [1,2,3]

    Data = [Channel_1, Channel_2]

    Read = 'TRUE '.

    ParameterNames = ("Data", "Read")

    Parameters = [data, read]

    VIPath = "Screw LabVIEW C:\Users\Sathish\Desktop\Calling of Python using LVRTE\Complex Data.vi"

    Reference #Get VI

    Application._FlagAsMethod ("GetVIReference")

    VirtualInstrument = Application.GetVIReference (VIPath)

    Front #Open VI in hidden mode

    VirtualInstrument._FlagAsMethod ("OpenFrontPanel")

    VirtualInstrument.OpenFrontPanel(True,3)

    #Call VI

    Print ("VI\n LabVIEW call")

    VirtualInstrument._FlagAsMethod ("Call")

    VirtualInstrument.Call (ParameterNames, Parameters)

    ...

    ...

    ...

    Error Msg:

    VirtualInstrument.Call (ParameterNames, Parameters)

    File ""> ", line 2, the call"

    com_error: (-2147352567, "Exception occurred.", (0, zero, zero, zero, 0,-2147352571), 2)

    However, the same code works for the second data attachment 2.jpg

    What I gather is that Python is not able to distinguish a data type of table 2D in a cluster having subclusters with the same number of elements, as in our example, a high-level group with two subclusters with 3 numeric characters. Is there a way to solve this problem. How explicitly I tell python that's a cluster and not a table?

    Thank you

    Sirot

    Data 1

    Data 2

    I modified your original Python script to work with comtypes. Here it is:

    #######

    types import *.
    import comtypes.client

    ComTypes. CoInitialize()

    # Path to the type library.
    TypeLibPath = "C:/Program Files / National Instruments/LabVIEW 8.6/resource/labview.tlb.

    # Attention: For the first reason of type import library through
    # GetModule() fails if comtypes.client.gen_dir is set to a directory.
    # Workaround: Set it to zero so all imported data is kept in memory.
    ComTypes.client.gen_dir = None
    comtypes.client.GetModule (TypeLibPath)

    Try:
    Request = comtypes.client.CreateObject ("LabVIEW.Application.8", zero, zero, comtypes.gen.LabVIEW._Application)

    #Parameters
    Channel_1 = [1,2,3]
    Channel_2 = [4,5,6]
    Data = [Channel_1, Channel_2]
    Read = 'TRUE '.
    ParameterNames = ("Data", "Read")
    Parameters = [data, read]
    VIPath="C:\zjmwi\ComplexData86.vi".

    Reference #Get VI
    VirtualInstrument = Application.GetVIReference (VIPath)

    Front #Open VI in hidden mode
    (VirtualInstrument.OpenFrontPanel (True, 1)#3)

    #Call VI
    Print ("VI\n LabVIEW call")

    VirtualInstrument.Call (ParameterNames, Parameters)

    except:
    VirtualInstrument = None
    Request = None

    # Sunrise again the exception to get the trace full on the console
    lift

    VirtualInstrument = None
    Request = None

  • Loading XML Labview schema files in python(or matlab)

    Hello

    Does anyone have experience loading labview XSD in python or matlab or similar?  Or is there a better format to the output into that could have an easier interface.  I guess I want to be able to use the labview interface I have as much as possible, but to any other treatment elsewhere.  Vaguely hoped that there could be a simple conversion or schema imput I can use - without having to maintain several different sets of input\output code on different systems - ideas?

    JP

    Thank you

    So I guess if you want something doing...

    I have implemented something that helps with analysis of the XML in python.  I must say that I have not tested much, but it seems to do the simple things I need ok at the moment. I have the joint where it might be useful for someone else.

    Basically, the two files that you need are LabviewXMLDataLoader.py and ContextDict.py - the first is the module that parses the XML, the second is a module that I also stole and maimed so that its easier to have nested 'dicitionaries"which I think are the closest in python to clusters in LV

    PulsedMeasurement_v2.py is an example of how I load a lv object variables into a python object.

    Anyway, as I said it is not perfect, but it's a starting point.

  • How to read data from OM - 62 temperature/humidity data logger in LabVIEW?

    Hello

    I have an Omega OM-62 temperature/humidity data logger I want to communicate (initialize recording, reading/writing data, stop recording) through LabVIEW 8.6. The OM-62 is connected to the PC via a type B USB-miniUSB connector, and I have provided "Omega Recorder program Interface" on my Windows operating system. I called online DAQ support Omega but I was told that data recorders low level like this have not provided capabilities of LabVIEW, which I fully understand.

    My question is why I have to use their program to communicate to this device? If I knew the syntax program them used to connect to the device, why can't I use through VISA? Do I need to build my own LabVIEW driver from their supplied driver?

    Python is easier to apply to this scenario solution?

    How can I see the code "Omega Interface Progam recorder" on my Windows operating system is using to communicate with the OM - 62 sensor?

    I just want to know how this could or could not work because I think I'm missing some concept in my understanding of programming LabVIEW/novice. It would be easier to run my LabVIEW program and their program at the same time, but I just want to understand it at a deeper level.

    Curosity killed the engineer occupation,

    Zach

    P.S. I have attached a few driver configuration information, but I have no idea if this is useful.

    Unless the manufacturer provides a kind of programming interface or API to communicate with the device that you have trouble with your own software interface to it whether LabVIEW or Python or something else. This could be in the form of a driver dll, Protocol series modbus (etc. etc. etc.).

    If it is not condition / available and you really need to communicate with the device, you will need to look at using something like a sniffer USB/driver (software? hardware?) to try to intercept communications between their software and the device. You can then use this information to try to understand what the commands it sends and the responses received and how to convert data.

    Once you have that until now... I don't know what options are willing LabVIEW for control of USB device, but a proposal, I would say that you would need either a driver USB low level or you have to write your own driver in another language and that call from LabVIEW.

  • Add external Python DLL to the project setup

    Hi all

    I have a Setup program, but can't seem to add a python DLL. There's that VI s that use the DLL, but for some reason, the project does not add the python DLL. I tried to do the project > add to the project, but that allow you to add files randomly, just of Labview files. Not sure why it is so restrictive.

    Any help would be appreciated.

    Thank you

    I thought about it. If you go to work in the project that lists, right-click the add menu has more options. Cordially for someone else.

  • I want to take a screenshot of another computer on the network of labview

    How could perform this...

    Computers A and B Compuer are connected to a network.

    Computer has labview

    Computer B has a labview.

    I want to be able to A computer with labview to take a screenshot of computer B.?

    I tryied to watch thightVNC or UltraVNC and they have not run an activex server so I can do... is there any other way?

    I haven't used, but I heard good things about Sikuli to automate actions such as screenshots or clicks of mouse on remote PCs.  It is a python based utility.

    http://doc.sikuli.org/screen.html

  • How to read the data from a channel named in windows using labview

    Hello

    I need to read the channel named in windows data. The pipe is created by python by another application. This application post permanent data on the pipe. But I don't know how to read data using labview. is it possible to read the data from different application? If possible, how to start?

    Thanks in advance

    concerning

    RJ

    Hi Rolf,.

    It's just, because of driving is not initialized completely, pipe read returns error 42, I added 2 seconds late, then its work perfect.

    Thank you very much.

    Concerning

    RJ

  • Python USB control 6009

    Hello

    I'm trying to use python (with types) to control my USB-6009.  The goal is to write an analog voltage and then read the voltage across an entry with the possibility to change the number of points on average and the number of times that it is repeated (sweeps) averaged analog analog input Board.  The problem is that, as we increase the number of times the voltage ramp is repeated (scans), we get a time-out error (call nidaq failed with the error-200284: ' some or all of the requested samples are not yet acquired).  This value confuse us because the scans are in a larger loop and the function of data acquisition should be the same if there is 10 scans (work) or 1000 scans (crashes).  Any ideas would be greatly appreciated.  I have included the code below for reference.

    import types

    Import numpy

    the import of time *.

    import of the operator adds

    NIDAQ = ctypes.windll.nicaiu # load the DLL

    ##############################

    # Configuration of the typedefs and constants

    # to match the values of

    # C:\Program NIUninstaller Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h

    # Settings for scanning

    aoDevice = "Dev2/ao0".

    aiDevice = "Dev2/ai0.

    NumAvgPts = 10

    NumSweeps = 50

    NumSpecPts = 100

    filename = "12Feb15_CO2 Test_12.txt".

    Readrate = 40000.0

    Sample rate = 1000

    StartVolt = 0.01

    FinalVolt = 1.01

    voltInc = (FinalVolt - StartVolt) / NumSpecPts

    # Typedefs

    Int32 = ctypes.c_long

    uInt32 ctypes.c_ulong =

    uInt64 = ctypes.c_ulonglong

    float64 = ctypes.c_double

    TaskHandle = uInt32

    # constants

    DAQmx_Val_Cfg_Default = int32(-1)

    DAQmx_Val_Volts = 10348

    DAQmx_Val_Rising = 10280

    DAQmx_Val_FiniteSamps = 10178

    DAQmx_Val_GroupByChannel = 0

    ##############################

    def CHK_ao (err):

    «"«a simple routine check error»»»

    If err<>

    BUF_SIZE = 100

    buf = ctypes.create_string_buffer ('\000' * buf_size)

    NIDAQ. DAQmxGetErrorString (err, ctypes.byref (buf), buf_size)

    raise RuntimeError (' nidaq call failed with error % d: %s'%(err,repr(buf.value))))

    If err > 0:

    BUF_SIZE = 100

    buf = ctypes.create_string_buffer ('\000' * buf_size)

    NIDAQ. DAQmxGetErrorString (err, ctypes.byref (buf), buf_size)

    raise RuntimeError ('nidaq generated WARNING % d: %s'%(err,repr(buf.value))))

    def CHK_ai (err):

    «"«a simple routine check error»»»

    If err<>

    BUF_SIZE = NumAvgPts * 10

    buf = ctypes.create_string_buffer ('\000' * buf_size)

    NIDAQ. DAQmxGetErrorString (err, ctypes.byref (buf), buf_size)

    raise RuntimeError (' nidaq call failed with error % d: %s'%(err,repr(buf.value))))

    def Analog_Output():

    taskHandle = TaskHandle (0)

    (nidaq. DAQmxCreateTask ("", ctypes.byref (taskHandle) "))

    (nidaq. DAQmxCreateAOVoltageChan (taskHandle,

    aoDevice,

    "",

    float64 (0).

    float64 (5).

    DAQmx_Val_Volts,

    None))

    '''

    (nidaq. DAQmxCfgSampClkTiming (taskHandle,"", float64 (Samplerate), ")

    DAQmx_Val_Rising, DAQmx_Val_FiniteSamps,

    uInt64 (NumAvgPts))); # means that we could turn into this growing streaming and playback

    '''

    (nidaq. DAQmxStartTask (taskHandle))

    (nidaq. DAQmxWriteAnalogScalarF64 (taskHandle, True, float64 (10.0), float64 (CurrentVolt), None))

    NIDAQ. DAQmxStopTask (taskHandle)

    NIDAQ. DAQmxClearTask (taskHandle)

    def Analog_Input():

    global average

    # initialize some variables

    taskHandle = TaskHandle (0)

    data = numpy.zeros ((NumAvgPts,), dtype = numpy.float64)

    # now on the program

    CHK_ai (nidaq. DAQmxCreateTask ("", ctypes.byref (taskHandle)))

    CHK_ai (nidaq. DAQmxCreateAIVoltageChan ("taskHandle, aiDevice," ",)

    DAQmx_Val_Cfg_Default,

    float64(-10.0), float64 (10.0).

    DAQmx_Val_Volts, None))

    CHK_ai (nidaq. DAQmxCfgSampClkTiming (taskHandle,"", float64 (Readrate), ")

    DAQmx_Val_Rising, DAQmx_Val_FiniteSamps,

    uInt64 (NumAvgPts)));

    CHK_ai (nidaq. DAQmxStartTask (taskHandle))

    read = int32()

    CHK_ai (nidaq. DAQmxReadAnalogF64 (taskHandle, NumAvgPts, float64 (10.0),)

    DAQmx_Val_GroupByChannel, data.ctypes.data,

    NumAvgPts, ctypes.byref (read), None))

    #print "%d points"%(read.value Acquired).

    If taskHandle.value! = 0 :

    NIDAQ. DAQmxStopTask (taskHandle)

    NIDAQ. DAQmxClearTask (taskHandle)

    average = sum (data) data.size

    Thank you

    Erin

    This forum is for questions of LabVIEW .

  • Send a table 1 d of test for MSSQL 2012 data

    Hello. Feel free to answer a number any of the sub questions you can. Thanks in advance!

    (1) being new to MSSQL, I don't know how to send a simple 1 d table of a floating number of type to a table in Microsoft SQL 2012. This is as far as I'm away. I get the message on the left with the VI current and one on the right when I get rid of the concatenation of strings of time and just carry the numbers going to the table name instead.

    2 (a), this is my Guinea pig file, running on a database of Guinea pig. Finally I want to send the data from a test procedure that records a piece of data per millisecond - a table usually end up with approximately 15 000 items, more or less - on the basis of data. Unfortunately, I know the misfortune that Labview can send only on one line at a time. So how the hell do I do a new column for each new piece of data for a test that will run for an indefinite period?

    2 (b) ideally, I would have a table with a column for each test was run, with the title of each column is the time and date at which the test was run. Is there a way to "transpose" the data once it's in MSSQL?

    I used the fixed data because it's a better illustation of how things work.

    If you need to write two items on one line at a time, then you need to group them together.  The error you are getting is because you have wired a double as input but listed two columns.  Notice that my last example wrote a cluster (which can be created with a fiber node) of two elements.  You must use together to create a cluster and time data, then thread this cluster node of your insert.

    A few other comments:

    Generally screws express is a reasonable place to start when you're new to LabVIEW, but you must learn to use shift registers do calendar between the execution of the loop.

    When it is to group the data and time together you need not to turn all this into a table first.  Just put the time in a single entry and your data in the other.  The groups you create are a single line of data.

Maybe you are looking for