Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: kwasposer on February 14, 2020, 10:16:45 pm
-
Hello, i was able to open a Enterprise Architect Model from python, with following commands
Unfortunatly I was not able to open a *.eapx File.
What do I have to do to open a *.eapx File?
import win32com.client
import sys
def ea():
try:
eaApp = win32com.client.Dispatch('EA.App')
eaRep = eaApp.Repository
except:
print("failure dispatch")
sys.exit(2)
try:
#------------------------------- How to open *eapx ? --------------------------------------------------------
eaRep.OpenFile2('C:\Sync\TestStand\Python\easparx\Model1.eap', 1, 0) # Working perfectly!
#eaRep.OpenFile2('"C:\Sync\Projekte\LISS\SysML\Model2.eapx"', 1, 0) # Not opening!
#------------------------------------------------------------------------------------------------------------------
except:
print("failure opening file")
sys.exit(2)
-
Can you open it "by hand"? EAPX requires Jet4 instead of Jet3.x for EAP files.
I usually access the running instance with the file already open and that works with no issu.
q.
-
I just tried that and had no issue opening a file that way.
Also '"C:\Sync\Projekte\LISS\SysML\Model2.eapx"' looks fishy with that double quotation.
q.
-
as qwerty has noticed the extension is not the only difference between the one working and the one not working.
The not working one also has double quotes around the filename.
eaRep.OpenFile2('C:\Sync\TestStand\Python\easparx\Model1.eap', 1, 0) # Working perfectly!
#eaRep.OpenFile2('"C:\Sync\Projekte\LISS\SysML\Model2.eapx"', 1, 0) # Not opening!
Geert
-
Sorry, it works.
What a silly mistake. Thank you all, for this quick reply!!
-
We all know that: staring for hours onto some obvious bug without seeing it xD
q.