While using Python4Capella I had a common problem while creating of some elements such as Operational Capabilities,Capabilities,Operational Activities.As an example the console error for operational capability creation is as the following:
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at com.sun.proxy.$Proxy25.executeScript(Unknown Source)
What is the Python code that generate this Java exception ?
Hello @YvanLussaud thanks for your response, in my python code I am creating Operational Capabilities and assigning them names using a defined list. The code is below:
OpCap = [" have videophone", " receive a message when my home care nurse is on her way", “be able to zoom into visual content”," decide who has access to my vital data"]
include needed for the Capella modeller API
from simplified_api.capella import *
change this path to execute the script on your model (here is the IFE sample).
comment it if you want to use the “Run configuration” instead
aird_path = ‘/My_1stProject/My_1stProject.aird’
model = CapellaModel()
gets the SystemEngineering and print its name
se = model.get_system_engineering()
print(“Model opened:” + se.get_name())
get the OperationalCapabilityPackage
ocap_pkg = se.get_operational_analysis().get_operational_capability_pkg()
start a transaction to modify the Capella model
# create operational capability with the list of names in the pre-defined list
for c in OpCap:
# create a Operational Capability
ocap.set_name© #set its name
# if something went wrong we rollback the transaction
# if everything is ok we commit the transaction
save the Capella model
This should be:
I’m in this thread looking for " ‘include’ is not defined…
This is my very first experience in python and my purpose is to prepare scripts to export all needed data for excel model analysis. Then my first try was to adapt sample “export_capabilities_and_owned_scenarios_to_xlsx”
On line 21 and 27 it says include(workspace:[path]), then I have put the path to my workspace where are both my capella project and my python4capella project
And on line 35: it says aird_path=[path/name.aird] which I replaced with my capella project path/aird file.
To be honest I did not understand clearly the discussion content and the link to the error I want to solve but as this thread appeared…
Thanks for any help
The include() instruction is not a Python instruction, it comes from EASE. This instruction is not recognized by the PyDev environment. You can find more explanation about this here.
You will need to run the script in the EASE context see the documentation here and for the run part here (make sure you followed the write script documentation first).
Running as EASE gives another response:
"org.eclipse.ease.ScriptExecutionException: TypeError: required field “type_ignores” missing from Module
org.eclipse.ease.ScriptExecutionException: TypeError: required field “type_ignores” missing from Module
org.eclipse.ease.ScriptExecutionException: TypeError: required field “type_ignores” missing from Module"
I have three lines of same text as you can see… What is “type_ignores”?
Thanks for your help
I didn’t experienced this error but someone else did see this discution.
I did read there, and found elsewhere information about validation and it was saying 5.0.0 was KO…
I’m running Capella 5.2 and EASE 1.0.1. My python engine is 3.7 (update back after trying 3.8: if was written somewhere that 3.8 was not compatible until massive EASE update was done… I hope Windows could go back to 3.7, but to be honest I don’t know where to figure out, it was installed by IT dept tool, on my requests… Everything is in folder Anaconda3.).
If anyone knows about compatibility versions, let me know
The versions provided by Pyhton4Cappella are the following:
- Capella 1.4.x or 5.x (version 6.x should work but need to be tested)
- EASE 0.7.0 (but you can upgrade to 0.8.0 version after that should be tested)
- Python 3.7.x (EASE 0.8.0 and lower have a known issue with newer versions of Python)
- see #119 (which is your issue… I missed that earlier)
- problem with numpy see #112
Thanks, still not checked: it seems that I had both version on my PC… Just ask to remove 3.8 now. done during next night I suppose…