labs4capella / python4capella

Python for Capella
Eclipse Public License 2.0
53 stars 10 forks source link

Relation "containedPhysicalPorts" defined on Node does not work #36

Closed Aurelien-Pin closed 3 years ago

Aurelien-Pin commented 3 years ago

Trying to execute the following script on the IFE sample model return an error (the error is on the line "for pp in npc.get_contained_physical_ports():")

It should be ensured that similar error will not appear on other relations in the simplified API!

Script:

for npc in se.get_all_contents_by_type(NodePC): npc = NodePC(npc) print ('export of ' + npc.get_name()) for pp in npc.get_contained_physical_ports(): pp = PhysicalPort(pp) print (pp.get_name())

Error:

py4j.Py4JException: An exception was raised by the Python Proxy. Return Message: Traceback (most recent call last): File "C:\Users\T0186002\MyApp\capella 1.4.2 P4C\eclipse\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.py", line 186, in runcode exec(compiled, self.locals) File "L/User Scripts/scripts/Need1.py", line 44, in _pyease_string_types = (str,) TypeError: iter() returned non-iterator of type 'JavaIterator'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\T0186002\MyApp\capella 1.4.2 P4C\eclipse\plugins\py4j-python_0.10.9.2-bnd-2odeag\src\py4j\clientserver.py", line 581, in _call_proxy return_value = getattr(self.pool[obj_id], method)(*params) File "C:\Users\T0186002\MyApp\capella 1.4.2 P4C\eclipse\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.py", line 335, in executeScript return self.executeCommon(code_text, self.interp.runcode, filename) File "C:\Users\T0186002\MyApp\capella 1.4.2 P4C\eclipse\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.py", line 313, in executeCommon execution_result = code_exec(code_text, filename) File "C:\Users\T0186002\MyApp\capella 1.4.2 P4C\eclipse\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.py", line 213, in runcode except Exception: TypeError: catching classes that do not inherit from BaseException is not allowed

at py4j.Protocol.getReturnValue(Protocol.java:476)
at py4j.reflection.PythonProxyHandler.invoke(PythonProxyHandler.java:108)
at com.sun.proxy.$Proxy30.executeScript(Unknown Source)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.internalExecute(Py4jScriptEngine.java:236)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.execute(Py4jScriptEngine.java:226)
at org.eclipse.ease.AbstractScriptEngine.inject(AbstractScriptEngine.java:245)
at org.eclipse.ease.AbstractScriptEngine.run(AbstractScriptEngine.java:309)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Aurelien-Pin commented 3 years ago

same applies when trying to have the following iteration: for npc in se.get_physical_architecture().get_physical_component_pkg().get_owned_physical_components():

ylussaud commented 3 years ago

This issue has been fixed by commit 9864e6ca848ea6c00bd06d097096ea046a13a708.