Menu

#228 makepy generates error during import LabVIEW TLB

open
nobody
win32 (141)
5
2005-06-27
2005-06-27
mkuner
No

System: XP Pro SP1
LabVIEW 7.1

the following code generates an error (see below code)

comment from M.Hammond:
>>
"D:\Python24\Lib\site-packages\win32com\client\makepy.py",
>> line 306, in GenerateChildFromTypeLibSpec
>> __import__("win32com.gen_py." + dir_name + "." +
child)
>> ImportError: No module named _Iapplication
>
>That is probably a bug related to tracking down
dependent typelibs. Maybe you could add an entry at
sourceforge?

------- Code start
---------------------------------------------
import win32com.client

oLv =
win32com.client.gencache.EnsureDispatch("LabView.Application")

oViTest =
oLv.GetVIReference("D:\\Projects\\py.lv.test\\pytest.vi","",True)
oViTest._FlagAsMethod("Call") # as
proposed from M.Hammond

bError = True # to
preset list object
strResult = "" # to
preset list object

arParNames = ["strEntry","strOutput","bError"] #
first and second are strings, third is bool
arParVals = ["Hello World", strResult, bError] #
first input, second+third output

result = oViTest.Call(arParNames,arParVals) # call VI

print result # show
changed (OUT) values

del oViLogPrint #
release link to LabVIEW VI (necessary !!)
--------- Code End
--------------------------------------------
Traceback (most recent call last):
File
"D:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "D:\Projects\py.lv.test\py-lv-example.py", line
3, in ?
oLv =
win32com.client.gencache.EnsureDispatch("LabView.Application")
File
"D:\Python24\Lib\site-packages\win32com\client\gencache.py",
line 529, in EnsureDispatch
disp = win32com.client.Dispatch(prog_id)
File
"D:\Python24\Lib\site-packages\win32com\client\__init__.py",
line 96, in Dispatch
return __WrapDispatch(dispatch, userName,
resultCLSID, typeinfo, UnicodeToString, clsctx)
File
"D:\Python24\Lib\site-packages\win32com\client\__init__.py",
line 38, in __WrapDispatch
klass = gencache.GetClassForCLSID(resultCLSID)
File
"D:\Python24\Lib\site-packages\win32com\client\gencache.py",
line 179, in GetClassForCLSID
mod = GetModuleForCLSID(clsid)
File
"D:\Python24\Lib\site-packages\win32com\client\gencache.py",
line 240, in GetModuleForCLSID
makepy.GenerateChildFromTypeLibSpec(sub_mod, info)
File
"D:\Python24\Lib\site-packages\win32com\client\makepy.py",
line 306, in GenerateChildFromTypeLibSpec
__import__("win32com.gen_py." + dir_name + "." + child)
ImportError: No module named _IApplication
----------------------------------------------------------------------

Discussion