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 <>
I was stuck on a problem today using an open statement where I was trying to open a file for writing


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

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


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

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