Tim Roberts schrieb: > Vinay Anantharaman wrote: >> Hi, >> >> I am trying to translate an error into text by using a library function in >> vix com: >> >> http://www.vmware.com/products/beta/vmware_server/vix_api/ReferenceGuide/lang/com/functions/GetErrorText.html >> >> My code is as follows: >> vixLib = win32com.client.gencache.EnsureDispatch('VixCom.VixLib') >> vixLib.GetErrorText(4, None) >> >> Instead of getting some explanation that a file was not found I get an >> exception: >> File >> "C:\Users\vinaya\AppData\Local\Temp\gen_py\2.4\7A474EE3-0062-4239-AE91-134AC9BD5FD3x0x1x0.py", >> line 1316, in GetErrorText >> , locale) >> TypeError: The VARIANT type is unknown (0x00000015) >> > > It's ironic that you posted this the same day as the other recent COM > question, because it is exactly the same problem. VARIANT type 0x15 is > VT_UI8 -- a 64-bit integer. It's kind of loony for an API to use a > 64-bit integer as an error number, but that's what they're doing. > > As Mark said, pywin32 doesn't support VT_UI8 at all. There may be a > hacky way to do this with comtypes.
I don't see anything hacky here; but ymmv: c:\sf\comtypes>py25 Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from comtypes.client import CreateObject >>> d = CreateObject("VixCom.VixLib") # Generating comtypes.gen._7A474EE3_0062_4239_AE91_134AC9BD5FD3_0_1_0 # Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0 # Generating comtypes.gen.stdole # Generating comtypes.gen.VixCOM >>> from comtypes.gen import VixCOM >>> d.GetErrorText(4, None) Traceback (most recent call last): File "<stdin>", line 1, in <module> _ctypes.COMError: (-2147417851, 'Ausnahmefehler des Servers.', (None, None, None, 0, None)) >>> d.Connect(1, VixCOM.VIX_SERVICEPROVIDER_VMWARE_SERVER, "", 0, "", "", 0, >>> None, None) <POINTER(IJob) ptr=0x292da4 at aebb70> >>> d.GetErrorText(4, None) u'A file was not found' >>> The first d.GetErrorText call fails because not all libraries are loaded when Connect has not yet been executed; according to this thread: http://communities.vmware.com/message/650022 -- Thanks, Thomas _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32