6
« on: January 12, 2005, 04:10:08 am »
Hi Oscar and bu66le,
I've had some success with accessing the EA model from Python in the past, but my luck seemed to have run out after upgrading to a more recent EA (4.50.743).
As I'm not that clued up on COM, I'm struggling to figure out exactly why things stopped working. Maybe someone can piece together a solution from my experiences.
I wrote a Python script that extracts and typesets requirements into a PDF document. After upgrading to EA 4.50.743, the script ceased to work (I cannot recall with which version it last worked, but I think it was 4.10.737) without any changes being made to the script. In the process of debugging the problem, I noted the following:
1. Executing "makepy" with no arguments presents a list of libraries in which EA *does not* feature. Previously, it featured there.
2. Using Microsoft's OLE/COM Object viewer ("oleview"), I see "Enterprise Architect Object Model 2.10 (Ver 2.a)" listed under "Type Libraries".
3. Executing "makepy" with "EA.tlb" as argument works, in that it generates the static dispatch Python proxies
to the EA objects (stored in gen_py). I noted that the new proxy was generated as version 2.10 and my old one as 2.2.
4. Using "GetClassForProgID", I am able to instantiate a repository object, using "EA.Repository" as prog ID. Unfortunately it fails at a call to "Repository.OpenFile" (as others reported) with a "Type mistmatch" error.
5. Calling "Repository.OpenFile2", results in a "Member not found" error.
6. Comparing the proxy objects of versions 2.2 and 2.10 shows the actual invocation (via "InvokeTypes") in OpenFile to be identical.
7. I can execute some other calls without causing errors, e.g. GetCounts().
Hope this can help us solve the problem. Any comments or suggestions would be appreciated.
Gerhard