This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author David.Townshend
Recipients David.Townshend, docs@python
Date 2011-08-16.13:49:16
SpamBayes Score 0.00048738773
Marked as misclassified No
Message-id <1313502559.06.0.415498401391.issue12760@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, opening a file with open(file, 'w') overwrites existing files.  It would be useful for open() to raise an error when the file exists.  This proposal is to add a 'c' mode to open, which has the effect to creating a file and opening it for writing, but raising an IOError if it already exists (i.e. the same as os.open(file, os.O_EXCL|os.O_CREAT).

The attached patch implements this, including tests and documentation.
History
Date User Action Args
2011-08-16 13:49:19David.Townshendsetrecipients: + David.Townshend, docs@python
2011-08-16 13:49:19David.Townshendsetmessageid: <1313502559.06.0.415498401391.issue12760@psf.upfronthosting.co.za>
2011-08-16 13:49:18David.Townshendlinkissue12760 messages
2011-08-16 13:49:18David.Townshendcreate