Issue in Python4Capella with Capella 6.0.0

I am testing the new CAPELLA 6.0.0 version. I have an issue with Python4Capella using the script

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


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


        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.

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

1 Like