PythonEventHandler problem after updating Orekit to 11.1 (from 10.x)

Hi Orekit users,

Could anyone please help me to address a problem in using PythonEventHandler?

I’m testing one example, python_files/test/BackAndForthDetectorTest.py, in the following link:

I replaced the package as follows:

in the example:
from org.orekit.python import PythonEventHandler

modified:
from org.orekit.propagation.events.handlers import PythonEventHandler

However, this example failed to run. Here’s an error message.

testBackAndForth (main.BackAndForthDetectorTest) … ERROR

======================================================================
ERROR: testBackAndForth (main.BackAndForthDetectorTest)

Traceback (most recent call last):
File “test_back_and_forth_detector.py”, line 105, in testBackAndForth
propagator.propagate(date1)
orekit.JavaError: <super: <class ‘JavaError’>, >
Java stacktrace:
java.lang.RuntimeException: AttributeError
at org.orekit.propagation.events.handlers.PythonEventHandler.init(Native Method)
at org.orekit.propagation.events.AbstractDetector.init(AbstractDetector.java:80)
at org.orekit.propagation.events.EventState.init(EventState.java:141)
at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.propagate(AbstractAnalyticalPropagator.java:130)
at org.orekit.propagation.AbstractPropagator.propagate(AbstractPropagator.java:265)


Ran 1 test in 9.161s

FAILED (errors=1)

This example had no problem when I ran it in Orekit 10.x.

Is there something I missed? Or should I rewrite this event handler for Orekit 11.1?

Look forward to getting your feedback.

Thank you for your help in advance!

Best,

Hi @ipark

I’m not a Python expert but the only thing I know is that the signature of the init(…) method of Orekit’s EventHandler interface has been modified between 10.X and 11.X.
The signature has changed from init(state0, targetEpoch) to init(state0, targetEpoch, detector).

I see two possibilities:

  • Probably this test is just obsolete
  • Or the PythonEventHandler was not updated

Best regards,
Bryan