# HG changeset patch # User nick # Date 1369407253 14400 # Node ID d83368b907f7d9998bfa5db62723bbd8d506f8ce # Parent 7c95db468ad5bf6c3968512954bf51462f38a159 No error on existing output file diff -r 7c95db468ad5 -r d83368b907f7 allele-counts.py --- 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")