First time here? Check out the FAQ!
asked 2012-07-25 02:37:48 +0200MikeW
I tried to use unoconv to convert all odg documents in a folder to svg but it just dies with "cannot find file". Is there something I am missing to able to do this?
python unoconv.py -f svg *.odg unoconv: file '*.odg' does not exist.
answered 2012-08-08 17:25:52 +0200MikeW
It appears that Windows understands wildcards in a different way than Linux and so LibreOffice or even Python cannot utilize ("*.odg") in Windows without using the "glob" module. (It seems that Python's implementation of OS recognizes *.odg as a literal filename in Windows instead of a wildcard).
To solve this, I had to write a wrapper like the following:
matches =  for root, dirnames, filenames in os.walk(os.getcwd()): for filename in fnmatch.filter(filenames, '*.odg'): matches.append(os.path.join(root, filename)) os.system("unoconv.py -f svg " + " ".join(matches))
I hope that helps others who encounter this same problem.
I don't know what exactly you are doing, what version of unoconv you are running, or why it failed. But it works perfectly on my system:
[dag@moria ~]$ unoconv -f svg test.odg [dag@moria ~]$ ls *.svg test.svg [dag@moria ~]$ file test.svg test.svg: SVG Scalable Vector Graphics image
It also works using wildcards:
[dag@moria ~]$ rm -f test.svg [dag@moria ~]$ unoconv -f svg *.odg [dag@moria ~]$ ls *.svg test.svg [dag@moria ~]$ file test.svg test.svg: SVG Scalable Vector Graphics image
I am using unoconv v0.5 and LibreOffice 3.4.5, so it should work !
answered 2012-07-26 05:34:18 +0200qubit
I'm not sure about the unoconv.py script (is that file provided by LO?), but here's how I convert Draw (odg) files to svg on the command line:
libreoffice -v --headless --convert-to svg test.odg
Note that if you already have LO running, that command will probably quit before doing any conversion for you. If you want to convert all odg files in a given directory, you can use a wildcard in your invocation like so:
libreoffice -v --headless --convert-to svg *.odg
LibreOffice is made available by volunteers around the globe, backed by a charitable Foundation. Please support our efforts: Your donation helps us to deliver a better product!
Asked: 2012-07-25 02:37:48 +0200
Seen: 723 times
Last updated: Feb 24