Difference between revisions of "Tips For Python Script Extensions"

From Inkscape Wiki
Jump to navigation Jump to search
Line 14: Line 14:


==Extensions on Mac OSX==
==Extensions on Mac OSX==
On OSX when running extension, it errors out with this error message:
''The fantastic lxml wrapper for libxml2 is required by inkex.py ...''
to fix that, do the following:


       sudo easy_install lxml
       sudo easy_install lxml
Line 20: Line 26:
       ln -s /usr/lib/libxml2.dylib
       ln -s /usr/lib/libxml2.dylib


 
source: http://caih.org/open-source-software/fixing-inkscape-in-mac-os-x/
 
----
 
[[Category:Extensions]]
[[Category:Extensions]]

Revision as of 01:41, 17 May 2012

Adding Translation Capability

One can add the ability to have Python text mesages included for translation. To provide an error message, rather than using the Python sys.stderr, use the provided errormsg() function from inkex.py in conjuction with gettext.

You must include the following at the beginning of your Python script:

import inkex
import gettext
_ = gettext.gettext

Where you wish to have an error message, write the following:

inkex.errormsg(_("This will be written to Python stderr"))

Of course, you may also change "_" to something else if you wish.

Extensions on Mac OSX

On OSX when running extension, it errors out with this error message:

The fantastic lxml wrapper for libxml2 is required by inkex.py ...

to fix that, do the following:

     sudo easy_install lxml
     cd /Applications/Inkscape.app/Contents/Resources/lib
     mv libxml2.2.dylib libxml2.2.dylib.old
     ln -s /usr/lib/libxml2.dylib

source: http://caih.org/open-source-software/fixing-inkscape-in-mac-os-x/