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 sean.grogan
Recipients docs@python, sean.grogan
Date 2020-12-02.16:09:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606925370.25.0.425660398835.issue42543@roundup.psfhosted.org>
In-reply-to
Content
I was stuck on a problem today using an open statement where I was trying to open a file for writing

e.g. 

    with open("RESULTS.CSV", "W") as csvfile:
        csvwriter = csv.writer(csvfile)
        csvwriter.writerow(["X", "Y"])
        csvwriter.writerows(data) 

I did not notice I had the mode W in upper case. I am not sure if there is a legacy reason for only allowing lower case arguments here but I think a quick note in the documentation that it's case sensitive or a check (or note) when throwing an error would be helpful?  such as 

    ValueError: invalid mode: 'W' -- your case appears to be an upper case, please ensure the case of the mode is correct

or 

    ValueError: invalid mode: 'W' -- note the mode is case sensitive

could be helpful?
History
Date User Action Args
2020-12-02 16:09:30sean.grogansetrecipients: + sean.grogan, docs@python
2020-12-02 16:09:30sean.grogansetmessageid: <1606925370.25.0.425660398835.issue42543@roundup.psfhosted.org>
2020-12-02 16:09:30sean.groganlinkissue42543 messages
2020-12-02 16:09:30sean.grogancreate