Extension Interpreters

From Inkscape Wiki
Jump to: navigation, search

Supported Interpreters

Inkscape Script extensions can use one of the following interpreters:

Language Name (in INX file) Name (in preferences.xml) Default value
Perl "perl" "perl-interpreter" "perl"
Python (on WIN32) "python" "python-interpreter" "pythonw"
Python (other systems) "python" "python-interpreter" "python"
Ruby "ruby" "ruby-interpreter" "ruby"
Shell "shell" "shell-interpreter" "sh"

(Code reference: /src/extension/implementation/script.cpp)

INX files

Within the INX file, you need to indicate the interpreter which will be used to execute the script, using the name given in the table above:


<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
    <command reldir="extensions" interpreter="python">my_extension.py</command>

Selecting a specific interpreter version (via preferences file)

In the preferences.xml file, a user can set a specific executable of the interpreter that Inkscape should use to execute extensions of a specific type.

This is especially useful, if the system's default version of the interpreter is incompatible with the one used by Inkscape's extension subsystem (e.g. Inkscape extensions that rely on inkex.py will only work with Python 2 (as of Inkscape 0.92.1), while on some recent Linux distributions, the default Python version used is Python 3, which results in errors during execution of extensions).

To change the executable that will be used to run script extensions to a different value than the default value in the above table, you need to do the following:

  1. quit all running Inkscape processes
  2. Open your perferences.xml file with a text editor (find the exact location of the file by going to Edit -> Preferences -> System: User Preferences)
  3. search the group which holds settings for the extension system itself and options of various extensions:
         org.ekips.filter.gears.angle="20" />
  4. Insert a key for the interpreter, for example 'python-interpreter' for setting the program that should be used to run python extensions, and set the string to the absolute path to the python binary which is compatible with Inkscape's current extension scripts (in the example below, the path is "/usr/bin/python2.7". It will look different on Windows systems.):
         org.ekips.filter.gears.angle="20" />
  5. Save the preferences file, and launch Inkscape to test the extensions.

See Also