Wednesday, December 02, 2009

openoffice Word to HTML conversion failed, ErrorCodeIOException - ErrCode = 1287

I'm converting Word documents to html using openoffice 3.1 headless version with uno protocol (python).
Reading the Word document with loadComponentFromURL was successful, but saving it as html using storeToURL threw com.sun.star.task.ErrorCodeIOException with ErrCode = 1287.

Interesting thing was the conversion worked great when I ran the code locally on the production server (debian 64), using the python's main function (if __name__ == "__main__"), but failed when I ran it from a remote machine, using http post.

I couldn't find this error code on the internet, so now that I've found the solution I'm posting it.

The issue was improper permissions for the soffice process to write the file in the target directory.

The soffice process ran under user A, and the python code ran under user B. The target directory was created in the python code, user B, so the soffice couldn't write in it.
When I ran the code locally, I logged in with user A, and that's why it worked. Had I logged in with user B I would have seen the same error.
Solution was to add users A and B to the same user group on the debian machine.

QED.

2 comments:

is_null said...

Thanks a HEAP!!!

Bruno Verachten said...

Will test, thanks.