ImportError using Jpype-based Python wrapper

Hi everyone !

I am getting an ImportError when trying to import the SphericalConstantThrustPropulsionModel class, using the Python wrapper with Jpype (Orekit v13.1):

raise ImportError("Failed to import '%s'" % name) from ex
E   ImportError: Failed to import 'org.orekit.forces.maneuvers.propulsion.SphericalConstantThrustPropulsionModel'

This does not happen when using JCC so I am a bit confused. We’ve also made sure the JVM was properly started before importing classes.

I went through existing topics on the subject (especially issue 4560) but could not find anything related to this specific problem. The class I am trying to import does not seem to be an interface or a Python-specific class which would only be callable with JCC.

Do I need to use another class with Jpype ?

Thanks !

Hi,

It seems to work on my machine in latest orekit_jpype, started with

uv run --with orekit_jpype python

>>> import orekit_jpype
>>> orekit_jpype.initVM()
>>> from org.orekit.forces.maneuvers.propulsion import SphericalConstantThrustPropulsionModel
>>> dir(SphericalConstantThrustPropulsionModel)
['DATATION_ACCURACY', 'THRUST_DECLINATION', 'THRUST_MAGNITUDE', 'THRUST_RIGHT_ASCENSION', 'THRUST_SCALE', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'equals', 'findByName', 'getAcceleration', 'getClass', 'getControl3DVectorCostType', 'getDateDetector', 'getDirection', 'getEventDetectors', 'getExhaustVelocity', 'getFieldDateDetector', 'getFieldEventDetectors', 'getFlowRate', 'getIsp', 'getMassDerivatives', 'getName', 'getNbParametersDriversValue', 'getParameterDriver', 'getParameters', 'getParametersAllValues', 'getParametersDrivers', 'getThrustMagnitude', 'getThrustVector', 'hashCode', 'init', 'isSupported', 'notify', 'notifyAll', 'toString', 'wait']

Hi Petrus,

Thank you for testing this, it made me realize I hadn’t updated Orekit in its Jpype version (I only updated the JCC version we are using). I was actually using Orekit v13.0.1, no wonder this class wasn’t found …

Thanks again !