Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unoconv command in debug mode to trace library path #89

Closed
chrisduong opened this issue Sep 18, 2012 · 6 comments
Closed

unoconv command in debug mode to trace library path #89

chrisduong opened this issue Sep 18, 2012 · 6 comments

Comments

@chrisduong
Copy link

I know this is silly, but I did download the latest version 0.6 from your github.
My OS is Centos 6 x86_64, python 2.6 from Base repository. Whenever I run "./unoconv -vvv -f pdf a.docx", I only received the following lines:

Verbosity set to level 3
Using office base path: /usr/lib64/libreoffice
Using office binary path: /usr/lib64/libreoffice/program
DEBUG: Connection type: socket,host=127.0.0.1,port=2002;urp;StarOffice.ComponentContext
DEBUG: Existing listener not found.
DEBUG: Launching our own listener using /usr/lib64/libreoffice/program/soffice.bin.
LibreOffice listener successfully started. (pid=27123)
Input file: Amazon bill.xlsx
Selected output format: Portable Document Format [.pdf]
Selected office filter: writer_pdf_Export
Used doctype: document
Output file: Amazon bill.pdf
DEBUG: Terminating LibreOffice instance.
DEBUG: Waiting for LibreOffice instance to exit.

The fact is: I can run smoothly with unoconv command in the terminal, however I failed to wrap unoconv script in php script. I always got error:

unoconv: Cannot find a suitable pyuno library and python binary combination in /usr/lib64/libreoffice
ERROR: Error during bootstrapping uno (RuntimeException):cannot open file:///root/.ure/types.rdb 
 unoconv: Cannot find a suitable office installation on your system.
ERROR: Please locate your office installation and send your feedback to:
       http://github.com/dagwieers/unoconv/issues

So that I want to trace back whether my unoconv finds all its library files. However I cannot with "-vvv" options. Please help me out, I fight this for 2 days.

@dagwieers
Copy link
Member

Ok, there are now a few issues open from people running unoconv through Apache or PHP. Please look at the existing tickets and read what they have learned already. #19 #24 #42 #44 #58 #73 #85 #87

Someone also wrote some documentation (see doc/) about running unoconv from a webserver and there are some hints in the README too.

Another important item to understand is that LibreOffice cannot run more than one conversion job at the same time so even if you would like to run unoconv as a web-service, you will have to make sure you queue and serialize the requests (something like flock may help).

And last but not least, report back if you have found the cause for an issue so other people can learn from your situation.

@dagwieers
Copy link
Member

BTW Since unoconv is a (simple) python script, you can always add specific print-statements to debug it. And in case you have some additional output that would be useful, I am interested to add it to unoconv.

However as already noted, the cause of your problems is unlikely to be unoconv itself, but the (restricted) environment of Apache/PHP.

@chrisduong
Copy link
Author

I will try to debug with the PHP script:
exec('UNO_PATH=/usr/lib64/libreoffice/basis3.4/program unoconv -vvv -f pdf '.$source_file 2>&1 | tee /var/log/unoconv.log);
I'll let you know if i find sth useful.

@chrisduong
Copy link
Author

I finally found the solution. Instead of using exec(), I use shell_exec to pass correctly UNO_PATH environment to python script.

@simkimsia
Copy link
Contributor

@chrisduong I tried your method. Didn't work for me.

This is my code.

    $command = 'unoconv -vvvv --format %s --output %s %s';
    $command = sprintf($command, $toFormat, $outputDirPath, $originFilePath);

    echo '<pre>';
    $command = 'UNO_PATH=/usr/lib/libreoffice/program ' . $command;
    $lastline = shell_exec($command);
    echo $lastline;
    echo '</pre>';

I get blanks when I tried to echo $lastline. Nothing happened basically. My issue is largely explained at #139

@castmetal
Copy link

Hi, I resolve with Unotools. I hope that you helps others: https://pypi.python.org/pypi/unotools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants