cctool

A tool for managing contacts and calendars.
git clone https://git.ce9e.org/cctool.git

commit
b721625df73d2a4f4f4021f747366455425409b8
parent
f533c476ba3c80e749aef890fc54b7963d1cdd8a
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2014-04-21 00:49
close infile before open outfile

Diffstat

M cctool.py 5 +++--

1 files changed, 3 insertions, 2 deletions


diff --git a/cctool.py b/cctool.py

@@ -361,8 +361,6 @@ if __name__ == '__main__':
  361   361 	reload(sys)
  362   362 	sys.setdefaultencoding('utf-8')
  363   363 
  364    -1 	outfile = sys.stdout if args.output is None else open(args.output)
  365    -1 
  366   364 	data = []
  367   365 	for fn in args.input:
  368   366 		ext = fn.split(os.path.extsep)[-1]
@@ -380,6 +378,8 @@ if __name__ == '__main__':
  380   378 		except Exception as e:
  381   379 			log.error(e)
  382   380 			sys.exit(1)
   -1   381 		if fn != '-':
   -1   382 			infile.close()
  383   383 
  384   384 	if args.merge is not None:
  385   385 		data = merged(data, key=args.merge)
@@ -387,6 +387,7 @@ if __name__ == '__main__':
  387   387 	if args.sort is not None:
  388   388 		data = sorted(data, key=lambda x: x[args.sort])
  389   389 
   -1   390 	outfile = sys.stdout if args.output is None else open(args.output)
  390   391 	try:
  391   392 		outformats[args.outformat]().dump(data, outfile)
  392   393 	except Exception as e: