slgobinath/libreoffice-code-highlighter

pukeage with Impress

Closed this issue · 5 comments

ubuntu 18.04,
python -- version
Python 2.7.15rc1
python3 --version
Python 3.6.5
Requirement already satisfied: pygments in /usr/local/lib/python3.6/dist-packages

com.sun.star.uno.RuntimeException: Error during invoking function highlight_java_default in module file:///home/james/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu3460qgxhl8.tmp_/codehighlighter.oxt/python/highlight.py (<class 'AttributeError'>: getCount
File "/usr/lib/libreoffice/program/pythonscript.py", line 875, in invoke
ret = self.func( *args )
File "/home/james/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu3460qgxhl8.tmp_/codehighlighter.oxt/python/highlight.py", line 751, in highlight_java_default
highlightSourceCode('java', 'default')
File "/home/james/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu3460qgxhl8.tmp_/codehighlighter.oxt/python/highlight.py", line 44, in highlightSourceCode
for item_idx in range(selected_item.getCount()):
)

I'm seeing this as well with LibreOffice 6.1.3.2:

com.sun.star.uno.RuntimeException: Error during invoking function highlight_automatic_default in module file:///home/XXX/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu28786c8x9bq.tmp_/codehighlighter.oxt/python/highlight.py (<class 'AttributeError'>: getCount
File "/opt/libreoffice6.1/program/pythonscript.py", line 905, in invoke
ret = self.func( *args )
File "/home/XXX/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu28786c8x9bq.tmp_/codehighlighter.oxt/python/highlight.py", line 78, in highlight_automatic_default
highlightSourceCode(None, 'default')
File "/home/XXX/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu28786c8x9bq.tmp_/codehighlighter.oxt/python/highlight.py", line 44, in highlightSourceCode
for item_idx in range(selected_item.getCount()):
)

It works in Writer (see issue #34). The result can be copied over to Impress as a work-around.

Please try the solution given under #34.

The workaround in #34 (select the text box, not the text itself) works as well, thanks.

However, I'd still call this a bug as selecting text and running the highlighter explodes in the user's face with a Python backtrace instead of e.g. telling the user how to get it to work.

Closing it as a possible duplicate.
I will mark #34 as a bug