LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Labview.exe front panel from python

With dos shell it doesn't work. I dont know why, but I dont have the time to check it.
But this has worked.

1. Unzip python.zip
2. Copy all files into c:\temp
    --> c:\temp\labview.py
    --> c:\temp\python.exe
    --> c:\temp\python.vi ......and so on

3. Open Pythonwin
4. PythonWin: File Open c:\temp\labview.py
5. Run --> Ok

Now it should work
0 Kudos
Message 11 of 31
(2,140 Views)
sorry with dosshell it doesnt work.

1. Unzip python.zip
2. Copy all files into c:\temp
    --> c:\temp\labview.py
    --> c:\temp\python.exe
    --> c:\temp\python.vi ......and so on

3. Open Pythonwin
4. PythonWin: File Open c:\temp\labview.py
5. Run --> Ok

0 Kudos
Message 12 of 31
(2,140 Views)

Dear baesi,

Could you please attach that pythonwin also please....

Thanks,

Mathan

0 Kudos
Message 13 of 31
(2,133 Views)
I' affraid not, but you can download it here:
Python:
http://www.python.org/download/releases/2.3.5/

Pywin:

http://starship.python.net/crew/mhammond/win32/Downloads.htmlbaesi

regards

baesi
0 Kudos
Message 14 of 31
(2,130 Views)
Hi Baesi,

Thanks for the reply.
I hav follwed, what u said.
I want to giv some data from lLV to Python.
Say some x is a variable in python script. I want giv the value to x from LV.
Then the result i have to monitor in LV.
Please guid me with this.

Thanks in advance,
Yogesh
0 Kudos
Message 15 of 31
(2,121 Views)

Hello,

Thanks for the post. But I have noticed one problem.

The examples posted by you works fine.

But, when you add the Labview file under a project then it doesn't.

I mean, add your Python.vi under one project and then try to run it, it doesn't work. It is not showing any update from python script.

 

 

What I think is - we need different dispatch method for calling a VI under a project.

(Dispatch(LabVIEW.Application) will create a reference for an application. If you want to refer to a VI which is under one project then it might need different referencing method)

 

If you know the solution please post the answer and if you are not clear about the question then I will be happy to post elaborated question.

0 Kudos
Message 16 of 31
(1,711 Views)

Does anyone know what this error mean when I run:

Code:

import win32com.client
labview = win32com.client.Dispatch("Labview.Application")
VI = labview.getvireference(r'C:\Test.vi')
VI.OpenFrontPanel()

 

Error:

Traceback (most recent call last):
  File "C:\Test.py", line 4, in <module>
    VI.OpenFrontPanel()
TypeError: 'NoneType' object is not callable

 

 

0 Kudos
Message 17 of 31
(1,605 Views)
Hello Avannes, Currently I am not using LabVIEW a lot but this was one of the problem I faced.
I think you have created a new project under which you have created a new vi. And I guess you are trying to control the front panel elements in that VI.

if yes, that means while calling any VI in any project it is not being called as an object. This can be solved as below.


Open the project window (not the vi). In the project window, observe the bottom line ( not the project contents, project window bottom line). Right click on that and choose the option which says ' application as object'.

Let me know if you can find it. If not then I will post with screen shots next week as diwali holidays are on in India!!
0 Kudos
Message 18 of 31
(1,585 Views)

One thing I don't understand:

    --> c:\temp\labview.py
    --> c:\temp\python.exe
    --> c:\temp\python.vi

 

Where are these files coming from? Ok I have my python file and my .vi file, I understand that. But where are python.exe, python.bld and python.tlb files coming from? I probably need them, because I cannot compile my own .py file. I can compile your example though.. So something is missing.

0 Kudos
Message 19 of 31
(1,378 Views)

I managed to compile my .py file. I don't need any of these .exe and other files, only the .vi and the .py. Adjusted the path according to that, and it worked just fine! 

0 Kudos
Message 20 of 31
(1,367 Views)