Python extensions fail to load on Mac with LO4

Michael Stahl mstahl at redhat.com
Thu Apr 18 02:03:37 PDT 2013


On 18/04/13 10:30, Alexander Thurgood wrote:

> pyuno MRI extension, which installs on all versions of LO from 3.3.4 to
> 3.6.5, but which fails to install on LO4.0.2.2 and LibreOfficeDev master
> build, with the following error message :
> 
> (com.sun.star.uno.RuntimeException) { { Message = "<class
> 'SyntaxError'>: invalid syntax (MRI.py, line 21), traceback
> follows\X000a
> /Applications/LibreOfficeDev.app/Contents/program/pythonloader.py:102 in
> function getModuleFromUrl() [codeobject = compile( src,
> encfile(filename), \"exec\" )]\X000a
> /Applications/LibreOfficeDev.app/Contents/program/pythonloader.py:149 in
> function writeRegistryInfo() [mod = self.getModuleFromUrl( locationUrl
> )]\X000a\X000a", Context = (com.sun.star.uno.XInterface) @0 } }

the problem is in MRI.py which is part of the extension.

"invalid syntax" often means using "print" as a statement, not a
function, or a whitespace inconsistency (tabs vs. spaces) which was
(fortunately) promoted to a syntax error in Python 3.

> Is there anything that has changed between 3.6.x and 4.x that would
> cause python extensions to fail to be loaded on OSX ?

yes :)  we ship Python 3 in LO 4, and Python 2 in LO 3.x.

the extension needs to be ported to Python 3.

you can point the author to http://python3porting.com/ which is very
useful... if you read carefully you can even figure out how to make
things run on both Python 2 and 3 (all Python code shipped with LO
should hopefully be able to do that).



More information about the LibreOffice mailing list