Hello all, I'm using a COM library through comtypes and I'd like to add exception handling to my code. Reading through this group I've understood comtypes is supposed to raise the COMError exception if something is wrong with the library. Is this correct?
Here is how I'm trying to handle it: # "piSeman" is an object created with comtypes.client.CreateObject() try: n = piSeman.Nodes[-1] # index cannot be less than 0, so it's a mistake except COMError: print('Error') sys.exit() However, upon executing the statement after "try" python simply crashes: > Problem signature: > Problem Event Name: BEX > Application Name: python.exe > Application Version: 0.0.0.0 > Application Timestamp: 53e3ddb5 > Fault Module Name: seman.dll > Fault Module Version: 1.0.0.1 > Fault Module Timestamp: 5449a83e > Exception Offset: 00242e0a > Exception Code: c0000417 > Exception Data: 00000000 > OS Version: 6.1.7601.2.1.0.256.48 > Locale ID: 1049 > Additional Information 1: 9604 > Additional Information 2: 96043c98bcbd85604ce467a759e6fd1e > Additional Information 3: 8b44 > Additional Information 4: 8b44ac3c9f876fe8047d534ff86187a6 > > Read our privacy statement online: > http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 > > If the online privacy statement is not available, please read our > privacy statement offline: > C:\Windows\system32\en-US\erofflps.txt I'm using comtypes 1.1.1 and python 3.4.1 on Windows 7. Could anyone please give me some direction? -- Best, Andy ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users