Ask Your Question
2

batch conversion with unoconv in Windows

asked 2012-07-25 02:37:48 +0200

MikeW gravatar image MikeW
56 1 6

updated 2013-01-29 10:09:44 +0200

qubit gravatar image qubit flag of United States
5693 3 48 41

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.
delete close flag offensive retag edit

Comments

It looks like the '*' (asterisk) character was removed from my post somehow. I attempted to use wildcards with LibreOffice directly and then with unoconv but neither work in a Windows environment (specifically Win7 though I doubt that makes a difference).

MikeW ( 2012-07-30 15:52:19 +0200 )edit

Hi @MikeW, I've updated the formatting in your post so that the asterisks are visible in the output.

qubit ( 2013-01-29 10:10:38 +0200 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2012-08-08 17:25:52 +0200

MikeW gravatar image MikeW
56 1 6

updated 2013-02-24 21:19:21 +0200

qubit gravatar image qubit flag of United States
5693 3 48 41

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.

link delete flag offensive edit

Comments

Makes sense. On Unix it is the shell that expands wildcards not the tool, on Windows it's probably the tool that expands wildcards and we may have to improve unoconv to also accept wildcards. So it's not exactly a bug. If you care about this functionality in unoconv, feel free to open an issue !

dag ( 2012-08-31 14:36:33 +0200 )edit
2

answered 2012-07-27 14:56:30 +0200

dag gravatar image dag
200 6 11
http://dag.wieers.com/blo...

updated 2012-07-27 14:57:07 +0200

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 !

link delete flag offensive edit
1

answered 2012-07-26 05:34:18 +0200

qubit gravatar image qubit flag of United States
5693 3 48 41

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

link delete flag offensive edit

Login/Signup to Answer

Donate

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!

Question tools

Follow
1 follower

subscribe to rss feed

Stats

Asked: 2012-07-25 02:37:48 +0200

Seen: 723 times

Last updated: Feb 24