comparison blast2html.py @ 107:ee2b105d772a

minor fix
author Jan Kanis <jan.code@jankanis.nl>
date Mon, 07 Jul 2014 12:20:28 +0200
parents b3b5ee557170
children ea3bc0b9a3d9
comparison
equal deleted inserted replaced
106:ed71448ee154 107:ee2b105d772a
453 if six.PY2: 453 if six.PY2:
454 # The argparse.FileType wrapper doesn't support an encoding 454 # The argparse.FileType wrapper doesn't support an encoding
455 # argument, so for python 2 we need to wrap or reopen the 455 # argument, so for python 2 we need to wrap or reopen the
456 # output. The input files are already read as utf-8 by the 456 # output. The input files are already read as utf-8 by the
457 # respective libraries. 457 # respective libraries.
458 458 #
459 # One option is using codecs, but the codecs' writelines() 459 # One option is using codecs, but the codecs' writelines()
460 # method doesn't support streaming but collects all output and 460 # method doesn't support streaming but collects all output and
461 # writes at once (see Python issues #5445 and #21910). On the 461 # writes at once (see Python issues #5445 and #21910). On the
462 # other hand the io module is slower (though not 462 # other hand the io module is slower (though not
463 # significantly). 463 # significantly).
464 464
465 # args.output = codecs.getwriter('utf-8')(args.output) 465 # args.output = codecs.getwriter('utf-8')(args.output)
466 # def fixed_writelines(iter, self=args.output):
467 # for i in iter:
468 # self.write(i)
469 # args.output.writelines = fixed_writelines
470
471 args.output.close()
466 args.output = io.open(args.output.name, 'w') 472 args.output = io.open(args.output.name, 'w')
467 473
468 templatedir, templatename = path.split(args.template.name) 474 templatedir, templatename = path.split(args.template.name)
469 args.template.close() 475 args.template.close()
470 if not templatedir: 476 if not templatedir: