Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40375
| References | <707df78f-9a67-4ce1-8dd3-095c75a7f7da@googlegroups.com> <kgtql2$s0p$1@ger.gmane.org> <CAPTjJmoRsQKr7iwwh38KR-=LjUT620VDzsR6kgX83KYArzxr8g@mail.gmail.com> <kgu0q9$d15$1@ger.gmane.org> |
|---|---|
| Date | 2013-03-03 10:17 +1100 |
| Subject | Re: Dealing with exceptions |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2804.1362266283.2939.python-list@python.org> (permalink) |
On Sun, Mar 3, 2013 at 10:08 AM, Terry Reedy <tjreedy@udel.edu> wrote:
> On 3/2/2013 5:16 PM, Chris Angelico wrote:
>>
>> On Sun, Mar 3, 2013 at 8:23 AM, Terry Reedy <tjreedy@udel.edu> wrote:
>>>>>>
>>>>>> open('sdjhfjshdfkjsh')
>>>
>>> Traceback (most recent call last):
>>> File "<pyshell#2>", line 1, in <module>
>>> open('sdjhfjshdfkjsh')
>>> FileNotFoundError: [Errno 2] No such file or directory: 'sdjhfjshdfkjsh'
>>>
>>> Now, does shutil pass on FileNotFoundError? I will let you experiment.
>>>
>>> There are error conditions that are hard to generate, but a bad file name
>>> is
>>> not one of them.
>>
>>
>> That's actually a perfectly valid file name, but one that doesn't
>> happen to have a corresponding file. However, the same technique will
>> work with the OP's description of "a filename which the FAT32 didn't
>> like" too.
>
>
> Yeah, that gives a different error and message.
>>>> open('a~`!@#$%^&*()_-+={[}]|\<,>.?/')
>
> Traceback (most recent call last):
> File "<pyshell#3>", line 1, in <module>
> open('a~`!@#$%^&*()_-+={[}]|\<,>.?/')
> OSError: [Errno 22] Invalid argument: 'a~`!@#$%^&*()_-+={[}]|\\<,>.?/'
That should be:
OSError: Profanity not permitted on respectable file systems
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 09:40 -0800
Re: Dealing with exceptions Kwpolska <kwpolska@gmail.com> - 2013-03-02 18:52 +0100
Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:35 -0800
Re: Dealing with exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-03 01:41 +0000
Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:35 -0800
Re: Dealing with exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-03 00:41 +0000
Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 12:04 +1100
Re: Dealing with exceptions Nobody <nobody@nowhere.com> - 2013-03-03 23:01 +0000
Re: Dealing with exceptions Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-02 10:58 -0700
Re: Dealing with exceptions Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-02 11:00 -0700
Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 05:21 +1100
Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:39 -0800
Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:39 -0800
Re: Dealing with exceptions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-02 19:18 +0000
Re: Dealing with exceptions Devin Jeanpierre <jeanpierreda@gmail.com> - 2013-03-02 14:27 -0500
Re: Dealing with exceptions Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-02 11:43 -0800
Re: Dealing with exceptions Terry Reedy <tjreedy@udel.edu> - 2013-03-02 16:23 -0500
Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 09:16 +1100
Re: Dealing with exceptions Terry Reedy <tjreedy@udel.edu> - 2013-03-02 18:08 -0500
Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 10:17 +1100
csiph-web