Closed cwant closed 1 year ago
For now, you can grab the corresponding command-line option passed to Simple Inkscape Scripting via extension.options.py_source
. I probably ought to provide a more robust mechanism, though.
That works for me, thanks!
Simple Inkscape Scripting now provides a predefined script_filename
variable. See https://github.com/spakin/SimpInkScr/wiki/Other-features#source-filename
Thanks again!
If I do
print(__file__)
in a script file that I load with this extension, it tells me the script is.config/inkscape/extensions/SimpInkScr/simple_inkscape_scripting.py
.It would be nice if there was a way to keep track where my script being run is (perhaps through an environment variable, e.g.,
INKSCAPE_SIMPLE_SCRIPT_FILE
or such).The use case is that I would like to set relative paths to set my python path to find libraries (e.g., I had expected that setting
sys.path.append('..')
would be relative to my script, not relative to the Inkscape extension code.) Having a way to locate my script file would help out with this.Thanks! (for the awesome extension!)