python issueshttps://gitlab.simantics.org/simantics/python/-/issues2023-05-11T09:52:21Zhttps://gitlab.simantics.org/simantics/python/-/issues/10Fix JNI libraries to support also Python 3.10 and 3.112023-05-11T09:52:21ZTuukka LehtonenFix JNI libraries to support also Python 3.10 and 3.11Fix JNI libraries to support also Python 3.10 and 3.11.
The problem after Python 3.10 is:
```
> import "Python"
> runPython $ executePythonStatement "print('Hello')"
org.simantics.pythonlink.PythonException: SystemError: PY_SSIZE_T_CLEA...Fix JNI libraries to support also Python 3.10 and 3.11.
The problem after Python 3.10 is:
```
> import "Python"
> runPython $ executePythonStatement "print('Hello')"
org.simantics.pythonlink.PythonException: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "SCL_INPUT", line 1, in <module>
SystemError: <built-in function write> returned a result with an exception set
at org.simantics.pythonlink.PythonContext.executePythonStatementImpl(Native Method)
at org.simantics.pythonlink.PythonContext.lambda$3(PythonContext.java:148)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
```
https://docs.python.org/3/c-api/arg.html#strings-and-buffers
> For all # variants of formats (s#, y#, etc.), the macro PY_SSIZE_T_CLEAN must be defined before including Python.h. On Python 3.9 and older, the type of the length argument is Py_ssize_t if the PY_SSIZE_T_CLEAN macro is defined, or int otherwise.
https://docs.python.org/3/c-api/intro.html
The following change in the native JNI code should be enough to fix the problem:
```diff
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
```https://gitlab.simantics.org/simantics/python/-/issues/8Python 3.8.6 (at least) crashes in Apros 6.102020-10-30T15:26:34ZReino RuusuPython 3.8.6 (at least) crashes in Apros 6.10Importing the "Python" module to SCL is succesfull, but using a "Hello world" example, the whole process crashes with a null pointer exception in native code.
From JVM crash report:
```
siginfo: ExceptionCode=0xc0000005, writing addres...Importing the "Python" module to SCL is succesfull, but using a "Hello world" example, the whole process crashes with a null pointer exception in native code.
From JVM crash report:
```
siginfo: ExceptionCode=0xc0000005, writing address 0x0000000000000000
...
Stack: [0x000000b154500000,0x000000b154600000], sp=0x000000b1545feb50, free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.simantics.pythonlink.PythonContext.createContextImpl()J+0
j org.simantics.pythonlink.PythonContext.lambda$1()Ljava/lang/Long;+0
j org.simantics.pythonlink.PythonContext$$Lambda$469.call()Ljava/lang/Object;+0
j java.util.concurrent.FutureTask.run()V+42
j java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+95
j java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
```
For some reason there are no listed native frames.https://gitlab.simantics.org/simantics/python/-/issues/7Using the python feature with Anaconda (workaround)2020-09-07T14:29:54ZReino RuusuUsing the python feature with Anaconda (workaround)A problem has been detected on some computers of a crash of the Simantics-based software on Python 3 installations from Anaconda. A detected workaround in at least some of these cases is to include a larger set of directories in the Path...A problem has been detected on some computers of a crash of the Simantics-based software on Python 3 installations from Anaconda. A detected workaround in at least some of these cases is to include a larger set of directories in the Path environment variable:
* ...\Anaconda3
* ...\Anaconda3\Scripts
* ...\Anaconda3\Library\bin
* ...\Anaconda3\Library\usr\bin
* ...\Anaconda3\Library\mingw-w64\binhttps://gitlab.simantics.org/simantics/python/-/issues/6Preference page for selection of Python installation2020-01-22T10:58:00ZReino RuusuPreference page for selection of Python installationCurrently, the selection of the Python environment is based on the presence of a python3.dll in the system's PATH variable.
For more flexibility, there should be an option that lets the user choose the home directory of the Python envir...Currently, the selection of the Python environment is based on the presence of a python3.dll in the system's PATH variable.
For more flexibility, there should be an option that lets the user choose the home directory of the Python environment that is to be used.Reino RuusuReino Ruusuhttps://gitlab.simantics.org/simantics/python/-/issues/1Use of the Python feature immediately crashes the JVM on some system configur...2019-10-23T10:57:49ZReino RuusuUse of the Python feature immediately crashes the JVM on some system configurationsA crash of the whole JVM has been encountered in an environment where a simple "Hello world" command is executed in
* Apros 6.09 (using the releases/1.35.1 branch)
* Python 3.5 installed via Anaconda3
* on a Dell XPS Laptop running Wind...A crash of the whole JVM has been encountered in an environment where a simple "Hello world" command is executed in
* Apros 6.09 (using the releases/1.35.1 branch)
* Python 3.5 installed via Anaconda3
* on a Dell XPS Laptop running Windows 10