Issue in Python4Capella with Capella 6.0.0

Hi,
I am testing the new CAPELLA 6.0.0 version. I have an issue with Python4Capella using the script List_logical_functions_in_console.py:

This error does’nt happen with CAPELLA 5.2. did I do something wrong?

thanks
dvd

You did nothing wrong, Your model contains Requirement and Attribute for those requirements. The script tha list all LogicalFunction use get_all_contents_by_type(LogicalFunction) this walks all the model and try to create Python object. At some point we try to create an Attribute but the class is defined in the requirement module.

You can replace the line:

        res = Attribute

with:

        res = getattr(sys.modules["__main__"], "Attribute")

This will only create Attribute if you included the requirement module in your script.

EDIT: I updated the release, you can resinstall to have this fix. I missed this bug before releasing. Thank you for the feedback.

Hi,
I downloaded your latest release. It works indeed.
an other suggestion: I have had to add “include(‘workspace://Python4Capella/simplified_api/requirement.py’)” in many scripts in the sample_scripts folder. It could be fine to also update the Python4Capella project.
see you soon in the forum !
dvd

1 Like