def main(): if len(sys.argv) < 2: print usage exit(1) for f in sys.argv[1:]: if not os.path.exists(f): print "%r: No such file or directory" % (f) codec = utils.getDecoder(f) if codec: print "Converting...", f, name, ext = os.path.splitext(f) codec(f).save(name + ".png") print "=> %s.png" % (name) else: print "Unknown file format for %s..." % (f) print usage
def main(): if len(sys.argv) < 2: print usage exit(1) files = [] for f in sys.argv[1:]: if not os.path.exists(f): print "%r: No such file or directory" % (f) codec = utils.getDecoder(f) if codec: print "Converting...", f name, _ = os.path.splitext(f) files.append(codec(f)) else: print "Unknown file format for %s..." % (f) print usage utils.show(files)