javajep

Hit "Fatal Python error" while creating JEP SubInterpreter in Java


I got the following error while creating JEP SubInterpreter in Java on Windows 10:

Fatal Python error: init_sys_streams: can't initialize sys standard streams
Python runtime state: core initialized
OSError: [WinError 6] The handle is invalid

And then the process exited.

This error does not occur every time, almost one tenth.

Any idea about this error?

Thanks!


Solution

  • This is caused by freopen() in C code, replace it with fopen() and dup2() could fix it. Please refer to: https://github.com/ninia/jep/issues/242