How to get Appy POD to work on Ubuntu 13.10?

Asked by Element Green on 2013-11-28

After upgrading to Ubuntu 13.10 it seems python-uno has been deprecated. There is now a python3-uno, but I don't think Appy POD has Python 3 support yet, right? Has anyone gotten Appy POD to work on Ubuntu 13.10?

I tried uninstalling libreoffice and installing openoffice from their website, which somewhat worked with Appy POD, but there were a lot of other annoying issues with openoffice. I'd like to use the libreoffice that comes with Ubuntu if possible.

Any help on this would be greatly appreciated.

Question information

Language:
English Edit question
Status:
Solved
For:
Appy Edit question
Assignee:
No assignee Edit question
Solved by:
Element Green
Solved:
2014-06-25
Last query:
2014-06-25
Last reply:
2014-06-18
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Hello,
Indeed, Appy is not Python3-ready yet.
Personally (I develop software with Appy as a one-man-show company), all my projects are still in Python2; all my servers are long-term versions (most recent being Ubuntu 12.04 LTS).
Currently I have no time to adapt Appy for Python3, any help would be appreciated!
Cheers
Gaëtan

Element Green (jgreen-users) said : #3

Today I just did a rough conversion using the Python 2to3 conversion script and some manual fixups described below:

file() -> open()
Converted raise 'string' to raise RuntimeError ('string')
The 2to3 script added extra parenthesis around print calls, removed them.

I removed a lot of uses of str.decode/encode, but I'm still a bit confused in regards to all those changes in Python 3, so I put FIXME around the sections that I commented out.

It seems like there is a lot of type checking of str versus unicode, which can probably get removed and may need some work.

At any rate, with the changes I made I managed to produce .odt and .pdf files of my manuals with Python 3, which makes heavy use of change tracked variable substitution and conditional inclusion of sections. The only issue I have seen so far is that PNG images inserted with "do text from document() are not showing up. I also saw this on a system with Python 2.7 and Appy POD though, so I'm not sure if that is an isolated issue to the 2to3 conversion or not.

I'd be happy to check in my changes somewhere or email you the archive, let me know what would be the most convenient way to get this out there. I highly suspect it still needs some manual work, but like I said, it did convert my documents which have a fairly high level of complexity.

Launchpad Janitor (janitor) said : #4

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Hi!
Finally we brought a solution to this problem with Luc Saffre. Thanks Luc!

The problem is to be able, from a Python 2 process running POD, to talk to LibreOffice 4 which is based on Python3.
There is a mode where POD forks a new Python process for talking to LibreOffice. This mode is enabled by using parameter "pythonWithUnoPath" when calling appy.pod.renderer.Renderer's constructor. If, for this parameter, you specify the absolute path to a Python-3-UNO-enabled Python interpreter, with Appy >= revision 548 it will work.

For example, with Ubuntu >= 13.10, the UNO-enabled Python-3 interpreter used by LibreOffice is /usr/bin/python3. So call the renderer with this param:

pythonWithUnoPath="/usr/bin/python3"

When the Python 2 process running POD will need to call LibreOffice, it will fork a Python 3 process that will execute script appy/pod/converter.py, that, for Appy >= revision 548, is the only part of the framework whose code currently works from Python2.4 to Python 3 included.

You will need to wait for upcoming Appy 0.9.0 to have this functionality in a published Appy version. I will publish it as soon as possible. In the meanwhile, get the Appy trunk from bazaar.

Element Green (jgreen-users) said : #6

Thank you! This works with Ubuntu 14.04. This is a much better solution than the hacked port of Appy to Python 3 that I did.