slgobinath / libreoffice-code-highlighter

Code snippet highlighter for LibreOffice Writer, Calc and Impress.
https://extensions.libreoffice.org/extensions/code-highlighter
Other
133 stars 16 forks source link

Scripting Framework error in Debian #28

Closed NandanDesai closed 5 years ago

NandanDesai commented 6 years ago

I have installed python3-pygments and libreoffice-script-provider-python. But I am getting the following error:

A Scripting Framework error occurred while running the Python script vnd.sun.star.script:codehighlighter.oxt|python|highlight.py$highlight_c_default?language=Python&location=user:uno_packages.

Message: <class 'ImportError'>: No module named 'pygments' (or 'pygments.styles' is unknown)
  /opt/libreoffice5.2/program/uno.py:265 in function _uno_import() [return _g_delegatee( name, *optargs, **kwargs )]
  /opt/libreoffice5.2/program/uno.py:339 in function _uno_import() [raise uno_import_exc]
  /home/nandan/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu148736yj1g.tmp_/codehighlighter.oxt/python/highlight.py:19 in function <module>() [from pygments import styles]
  /opt/libreoffice5.2/program/pythonscript.py:452 in function getModuleByUrl() [exec(code, entry.module.__dict__)]
  /opt/libreoffice5.2/program/pythonscript.py:993 in function getScript() [mod = self.provCtx.getModuleByUrl( fileUri )]

pip show pygments outputs the following:

Name: Pygments
Version: 2.2.0
Summary: Pygments is a syntax highlighting package written in Python.
Home-page: http://pygments.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD License
Location: /home/nandan/anaconda3/lib/python3.6/site-packages
Requires: 
Required-by: Sphinx

which clearly shows that pygments is installed. And it is getting imported in interactive python terminal. I tried restarting libreoffice. But no effect.

ruben1981 commented 6 years ago

I've resolved just copying the Pygments directory from /usr/lib/pythonx.x.x/site-packages to /opt/libreofficex.x/python-core-x.x.x/lib/site-packages. It completely works, now.

slgobinath commented 5 years ago

Closing this issue as a duplicate of #29