Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#14 Returned tuple from COM method doesn't include all outputs

open
nobody
None
5
2014-02-19
2009-08-12
Anonymous
No

I am accessing SolidWorks via COM using comtypes. I create a new application object as follows:
swApp=comtypes.client.CreateObject('sldworks.application')

To open files with this application, you use the OpenDoc6 method, which is as follows:
ModelDoc2 OpenDoc6(string FileName, int Type, int Options, String Configuration, [Out] int Errors, [Out] int Warnings) (taken from the api help files.

When I call swApp.OpenDoc6, the ModelDoc2 object is not returned. Instead I only get a tuple containing the Errors and Warnings.

I have possible solution, which might not necessarily be all that good:
If I change comtypes/__init__.py line 599 to use rescode (the return from the function) as opposed to outargs, then I get a tuple containing all three outputs. Not sure this would work for all COM libraries.

djm one five eight @ieee.org (where the numbers are really numbers) to ask questions of me.

Discussion