PyCharm Debugger terminates when calling Orekit objects

Dear all,

I am currently doing some tests with the Python wrapper of Orekit. While debugging a simple python script, using PyCharm as IDE, as soon as there is a call to a java object the debugger terminates with the following error:

Process finished with exit code -1073741819 (0xC0000005)

Here below you can find the example that I am using:

import orekit
vm = orekit.initVM()
from orekit.pyhelpers import setup_orekit_curdir
setup_orekit_curdir()
from org.orekit.time import TimeScalesFactory
from org.orekit.propagation.analytical.tle import TLE
utc = TimeScalesFactory.getUTC() # Setting here the breakpoint and advancing (“Step Over”) causes the failure
TLE_LINE1 = “1 27421U 02021A 02124.48976499 -.00021470 00000-0 -89879-2 0 20”
TLE_LINE2 = “2 27421 98.7490 199.5121 0001333 133.9522 226.1918 14.26113993 62”
tle = TLE(TLE_LINE1, TLE_LINE2)

Python scripts which are not relying on the wrapping are working fine in PyCharm, only when orekit objects are called I encounter this issue.
I’ve also noticed that the same behaviour appears when trying to display the content of a variable connected to Orekit. For instance after the following call:

from org.orekit.propagation.sampling import PythonOrekitFixedStepHandler

trying to inspect the content of PythonOrekitFixedStepHandler terminates the debugger.

I tried a fresh installation of Python and PyCharm, even downgrading it, however none of them seem to have an effect. I am using the latest version of PyCharm and Python 3.7.10. The python interpreter is set as in the Wiki of the wrapper.

I am wondering if someone else had this issue with PyCharm? If so please let me know!

Thank you for your answers

Kind Regards,
Leonardo

Hi Leonardo,

Yes there are some issues with PyCharm debugging and orekit, likely something to do with the wrapping of orekit and that PyCharm is using some unusual inspection of objects. This started with the support of python version 3. There are some issues registered on this, and they are probably connected:
issue 427
issue 430
issue 418

The problems can somewhat be mitigated by turning off the dynamic loading of variables in PyCharm (to on demand). I use PyCharm, orekit and debugger, but mostly accessing the variables in the ipython console that i find a very useful feature of the debugger.

Note to self and others who may attempt to find this bug - I think the first step would be to recreate this error by an inspection outside the PyCharm environment and get a reproducable test case…

Hi Petrus,

many thanks for you quick reply, I’ve tried your suggestion and it is working.
Thanks also for pointing me to the issues, they seem indeed to be connected.

I’ll let you know if I find a python script that fails also outside PyCharm.

As a side note: do you think that it would make sense to report this as a non compliant behaviour to the IntelliJ team? Maybe they could help…
It seems that this is happening only there. Using PyDev on Eclipse, with the same python interpreter, I have no issues.

Thanks again,

Kind Regards,
Leonardo

If you’re at all flexible on environment, VS Code does not have this problem. You must be sure to launch VC Code from the conda environment to get it to work, or launch the build-in VS Code that comes with eg. Anaconda, etc.

Thank you for the suggestion, I’ll give it a try.