If you have a Python3-only extension, how do you force the system to request interpreter 'python3' which will reliably be python3, rather than 'python' which could be either? I tried
I'm on the 'trunk' version of inkscape from the trunk PPA, and I cloned the extension repository yesterday.
The current setup seems less than ideal...
You can't reliably know if 'python' is going to be python2 or python3, but usually it is going to be python2. It seems unreasonable to make users change the python interpreter to run your extension, and so I would argue that means it isn't currently possible to write a python3 only extension.
Actually I found a trivial, if hacky, workaround, which is to call a script which calls
python3 <my script.py> "$@"
which works for my output extension (possibly you need to redirect stdin/stdout for some?).
Hi there, I just have install the last version of inkscape and tried your trick @Ede_123 . Problem is, when I restart inkscape and select my extension (Tex Text), a box opened to ask me specifically python 3 !!
"Inkscape extensions require Python 3.6 or greater."
Yes sorry it's my fault, I didn't followed the official documentation correctly (https://textext.github.io/textext/install/linux.html) and installed an older version of Tex Text which were written in python 2. I have uninstalled/installed inkscape and then followed the extension installation documentation correctly (with the setup.py) and now everything is working very well. Thanks for your answer because it made me read through the instruction again !!
Hi all,
If you have a Python3-only extension, how do you force the system to request interpreter 'python3' which will reliably be python3, rather than 'python' which could be either? I tried
<command reldir="extensions" interpreter="python3">
but that gave me an error
Script::resolveInterpreterExecutable(): unknown script interpreter 'python3'
although the script works fine if run manually on the command line.
Mmh. Which Inkscape version is that? And does it work when you enter an absolute path there?
Interpreter names are fixed.
For instructions on how to configure the executables used for specific interpreters, see https://wiki.inkscape.org/wiki/index.php/Extension_Interpreters.
I'm on the 'trunk' version of inkscape from the trunk PPA, and I cloned the extension repository yesterday.
The current setup seems less than ideal...
You can't reliably know if 'python' is going to be python2 or python3, but usually it is going to be python2. It seems unreasonable to make users change the python interpreter to run your extension, and so I would argue that means it isn't currently possible to write a python3 only extension.
Actually I found a trivial, if hacky, workaround, which is to call a script which calls
python3 <my script.py> "$@"
which works for my output extension (possibly you need to redirect stdin/stdout for some?).
Hi there, I just have install the last version of inkscape and tried your trick @Ede_123 . Problem is, when I restart inkscape and select my extension (Tex Text), a box opened to ask me specifically python 3 !!
"Inkscape extensions require Python 3.6 or greater."
What's wrong now ?
Do you have Python 3.6 or greater installed, @alex56 ? Current Inkscape comes with Python 3 already, so you shouldn't need to do anything.
Yes sorry it's my fault, I didn't followed the official documentation correctly (https://textext.github.io/textext/install/linux.html) and installed an older version of Tex Text which were written in python 2. I have uninstalled/installed inkscape and then followed the extension installation documentation correctly (with the setup.py) and now everything is working very well. Thanks for your answer because it made me read through the instruction again !!