Mercurial > repos > nick > allele_counts_1
changeset 2:d83368b907f7
No error on existing output file
author | nick |
---|---|
date | Fri, 24 May 2013 10:54:13 -0400 |
parents | 7c95db468ad5 |
children | 4627d99aa105 |
files | allele-counts.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/allele-counts.py Fri May 24 08:55:29 2013 -0400 +++ b/allele-counts.py Fri May 24 10:54:13 2013 -0400 @@ -99,10 +99,10 @@ if outfile == OPT_DEFAULTS.get('outfile'): outfile_handle = sys.stdout else: - if os.path.exists(outfile): - fail('Error: The given output filename '+outfile+' already exists.') - else: + try: outfile_handle = open(outfile, 'w') + except IOError, e: + fail('Error: The given output filename '+outfile+' could not be opened.') if print_header: outfile_handle.write('#'+'\t'.join(COLUMNS)+"\n")