Skip to content

Commit d297dfe

Browse files
committed
Remove argparse.FileType from log output
1 parent dd3a4cb commit d297dfe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

primertrim/command.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def main(argv=None):
2929
)
3030
io_group.add_argument(
3131
"--log",
32-
type=argparse.FileType("w"),
3332
help="Log file of primers and location (default: not written)",
3433
)
3534
io_group.add_argument(
@@ -140,8 +139,10 @@ def main(argv=None):
140139
output_reads = trimmable_reads.output_reads(args.min_length)
141140
write_fastq(output_fastq, output_reads)
142141

143-
output_loginfo = trimmable_reads.output_loginfo()
144-
write_log(args.log, output_loginfo, trimmable_reads.loginfo_colnames)
142+
if args.log:
143+
output_loginfo = trimmable_reads.output_loginfo()
144+
with open(args.log, "w") as f:
145+
write_log(f, output_loginfo, trimmable_reads.loginfo_colnames)
145146

146147

147148
def write_fastq(f, reads):

0 commit comments

Comments
 (0)