Add workaround for Inkscape error on macOS

This commit is contained in:
Martin Müller 2019-02-28 01:31:40 +01:00 committed by Florian Festi
parent 10ad21d186
commit e2090e9999
1 changed files with 47 additions and 0 deletions

View File

@ -68,3 +68,50 @@ are required:
3. Now :code:`boxes` and :code:`boxesserver` can be runned like other commands 3. Now :code:`boxes` and :code:`boxesserver` can be runned like other commands
and the Inkscape extension should be available. and the Inkscape extension should be available.
Troubleshooting
...............
When using the Inkscape extension something like the following error
might occur:
::
Traceback (most recent call last):
File "/Users/martin/.config/inkscape/extensions/boxes", line 107, in <module>
main()
File "/Users/martin/.config/inkscape/extensions/boxes", line 47, in main
run_generator(name, sys.argv[2:])
File "/Users/martin/.config/inkscape/extensions/boxes", line 73, in run_generator
box.close()
File "/usr/local/lib/python3.7/site-packages/boxes-0.1-py3.7.egg/boxes/__init__.py", line 594, in close
svgutil.svgMerge(self.output, self.inkscapefile, out)
File "/usr/local/lib/python3.7/site-packages/boxes-0.1-py3.7.egg/boxes/svgutil.py", line 144, in svgMerge
from lxml import etree as et
ImportError: dlopen(/Applications/Inkscape.app/Contents/Resources/lib/python2.7/site-packages/lxml/etree.so, 2): Symbol not found: _PyBaseString_Type
Referenced from: /Applications/Inkscape.app/Contents/Resources/lib/python2.7/site-packages/lxml/etree.so
Expected in: flat namespace
This is because Inkscape on macOS ships its own version of Python 2.7 where
:code:`lxml` and other dependencies are missing.
A workaround is to edit the file at
:code:`/Applications/Inkscape.app/Contents/Resources/bin/inkscape`.
At line 79 there should be following code:
.. code::
export PYTHONPATH="$TOP/lib/python$PYTHON_VERS/site-packages/"
which needs to be changed to
.. code::
#export PYTHONPATH="$TOP/lib/python$PYTHON_VERS/site-packages/"
This forces Inkscape to use the Python version installed by Homebrew which
has all the necessary dependecies installed.
Note: This might break other extensions. In this case simply change the line
back and restart Inkscape.