Hello,
is there a way to prevent the application from crashing if the PythonQt::init() function call fails due to an incorrect Python configuration?

In my application the user can set the PYTHONHOME and PYTHONPATH path to an individual Python environment.
If the chosen path does not lead to a Python environment or does not exist at all, the application crashes with the following error:

Fatal Python error: initfsencoding: unable to load the file system codec
Fatal Python error: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x000005f8 (most recent call first):

Is there any way to prevent the application from crashing?

Thanks in advance.

 

Last edit: Stanislaus Reitenbach 2019-08-16