import os

def convert_file( filename):
  plugin = "ODF" # the name of the export plugin
  if App.load_CDML( filename):
    outname = os.path.splitext( filename)[0] + ".odg"
    if App.plugin_export( plugin, filename=outname):
      print filename, "=>", outname
    else:
      print "export error"

for arg in Args:
  if os.path.isdir( arg):
    for f in os.listdir( arg):
      if f.endswith( ".svg"):
        convert_file( os.path.join( arg, f))
  elif os.path.isfile( arg):
    convert_file( arg)
  else:
    print "%s is neither a file nor a directory, skipping" % arg



