Search code examples
pythonpython-2.7python-2.xpyuno

Python 2.7 with pyuno


I am having python 2.7 installed on my windows 7. I have installed Libre Office 3.4 which comes with python 2.6. Hence i am not able to import uno and unohelper even after setting all environment variables.

I need python 2.7 thus cannot revert back to python 2.6, as i earlier had python 2.6 working with open office 3. I recently changed to LibreOffice 3.4 and Python 2.7(ActivePython 2.7).

Is there any way i can make python 2.7 to import uno and unohelper of LibreOffice 3.4

Thanks in advance.


Solution

  • .pyc files and C extensions are not compatible between 2.6 and 2.7 Python versions. Install pylauncher and use python2.6 shebang in scripts that work with Libre Office.

    From the link provided in the answer to OpenOffice.org development with pyUno for Windows—which Python? question:

    Terms: Let's call the version of Python installed with OpenOffice the 'OO-Python'. Let's call the version of Python installed separately (to c:\Python26, for example) the 'System-Python'.

    You need to know SIX things to sucessfully import the uno module into your System-Python interpreter. 1) The OO-Python version number. Your System-Python version number must be the same as your OO-Python version number. [emphasis mine] ...