3

I am trying to use unoconv for file conversion

I have downloaded LibreOffice and added C:\Program Files (x86)\LibreOffice 5\program , path where python.exe, pyuno.pyd and soffice.exe resides, to system path variable, so that when I run C:\Users\user> python its working

I also downlaoded Unoconv zip from https://github.com/dagwieers/unoconv
extracted it and placed the folder inside C:\Program Files (x86), so that the unoconv files is located here C:\Program Files (x86)\unoconv-master

Now in the command prompt when I run C:\Users\user > python unoconv -h,

I get this error C:\Program Files (x86)\LibreOffice 5\program\\python-core-3.3.0: can't open file 'unoconv' : [Error 2] No such fiel or directory

but when I navigate to unoconv folder and run the same command

C:\Program Files (x86)\unoconv-master > python unoconv -h it works fine,

I have also added C:\Program Files (x86)\unoconv-master in system path variable and created a UNO_PATH variable with C:\Program Files (x86)\LibreOffice 5\program

how to run the python unoconv -h command from any location, without navigating to unoconv folder?

Update: Actually I am working on a larvel application and trying to use unoconv, for this, along with above setup have used php-unoconv library https://github.com/alchemy-fr/PHP-Unoconv, but when running the basic code given in docs of php-unoconv I get the below error

ExecutableNotFoundException in AbstractBinary.php line 160: Executable not found, proposed : unoconv

how to fix this error ? I thought it must be something to do with system environment variable, if not then any idea on why I am getting this error

Uttara
  • 2,496
  • 3
  • 24
  • 35
  • Run `python -c "import sys; print(sys.path)"` to see the directories it searches. Is there a `site-packages` directory in there? Try adding a `unoconv.pth` text file with a single line: `C:\Program Files (x86)\unoconv-master`. If a .pth file doesn't work for you, add the directory to the `PYTHONPATH` environment variable. It's best to do this in a batch file that sets up the working environment, as opposed to setting `PYTHONPATH` permanently. – Eryk Sun Mar 10 '16 at 19:33
  • yes I got the `site-packages` directory, added `unoconv.pth` file and also tried with `unoconv.pth.txt` file, but still getting the same error in terminal. Also added `C:\Program Files (x86)\unoconv-master` to `PYTHONPATH` environment variable but its still the same – Uttara Mar 11 '16 at 05:30
  • Sorry, I forgot to mention that you need `-m`, for example `python -m unoconv`, when running a package from `sys.path` as a script. – Eryk Sun Mar 11 '16 at 05:46
  • tried this `python -m unoconv -h` an dgot this `C:\Program Files (x86)\LibreOffice 5\program\python-core-3.3.0\bin\python.exe: No module named unoconv` – Uttara Mar 11 '16 at 06:06
  • I assume this was with a .pth file or the directory in `PYTHONPATH`? Try just running python to get the interactive shell. Then do `import sys` and `sys.path.append(r'C:\Program Files (x86)\unoconv-master')`. The try `import unoconv` and `dir(unoconv)`. – Eryk Sun Mar 11 '16 at 06:10

0 Answers0