ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Launch LabView Application through Python

Hello Team,

 

I tried to launch LabView application using python code as follows:

 

import win232com.client

labview_app = win32com.client.Dispatch('LabVIEW.Application')

 

But it gives an error: pywintypes.com_error: (-2146959355, 'Server execution failed', None, None)

 

I have also tried one of the solutions mentioned in the forum:

 

from ctypes import *
import comtypes.client
comtypes.CoInitialize()

 

TypeLibPath = r'C:\Data\labview.tlb"

comtypes.client.gen_dir = None
comtypes.client.GetModule(TypeLibPath)

 

Application = comtypes.client.CreateObject("LabVIEW.Application.8", None, None, comtypes.gen.LabVIEW._Application)

 

But this gives me an error on comtypes.client.CreateObject line: AttributeError: module 'comtypes.gen' has no attribute 'LabVIEW'

 

LabView version installed: LabView2016 (32-bit)

ActiveX Server Name: LabviewHIL

Python version: Python3.7.9 (32-bit)

 

Could you please let me know what am I missing out to correctly launch Labview Application using python code?

 

Thanks,

Reena

0 Kudos
Message 1 of 2
(2,263 Views)

Hello reena1908,

 

Did you see this forum case: Solved: Calling LabVIEW VI's from Python - NI Community? Here show similar things.

 

Best Regards.

0 Kudos
Message 2 of 2
(2,154 Views)