Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40375

Re: Dealing with exceptions

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'filename': 0.07; 'shutil': 0.07; 'argument:': 0.09; 'be:': 0.09; 'terry': 0.09; 'yeah,': 0.09; 'experiment.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'generate,': 0.16; 'oserror:': 0.16; 'reedy': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'file.': 0.20; '"",': 0.22; 'permitted': 0.22; 'pass': 0.25; 'header:In-Reply- To:1': 0.25; '(most': 0.27; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'chris': 0.28; '>>>>': 0.29; "skip:' 10": 0.30; 'error': 0.30; 'file': 0.32; 'message.': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85.220': 0.35; 'too.': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; "didn't": 0.36; 'subject:with': 0.36; 'should': 0.36; 'bad': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'description': 0.39; 'gives': 0.39; 'to:addr:python.org': 0.39; 'different': 0.63; '2013': 0.84; 'directory:': 0.84; 'respectable': 0.84; 'technique': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=Qap9l2MGuttzva4UNQz9UrnctkS4YxisvUEfZCRabos=; b=d4Fa687kGeD38aqM+SwKP7U+JwbWsX/+J7CKo1OOU4D3LvDOj0hWQzSAQ+q01j5IQv AxcB8YzIOzijzSgDQlaPM03iUfPxIxzUcpAwEW1KM7WsxFvVrCDKPTD28DkVBUTxr0VW IrijS0LTDeBVyefcdVD7u9kbe47RLhsGKgN9zyY1ETU0AChGGEB+RDa215PLIZwXhtt8 AM1ud+NJZgO2O7DU+fxtJeI05QPmAHPb0KGsRAQcRpq6dEUZI1Hj02r89NydMxC2+7hs 0XupKn9ozX0C5HSYMcN+TdKpXPyi99Taqh8ARTeW5kkQOtimb7TtrAB1pMgdXrIeZpEl 2tfQ==
MIME-Version 1.0
X-Received by 10.52.29.209 with SMTP id m17mr5122164vdh.111.1362266275320; Sat, 02 Mar 2013 15:17:55 -0800 (PST)
In-Reply-To <kgu0q9$d15$1@ger.gmane.org>
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 Sun, 3 Mar 2013 10:17:55 +1100
Subject Re: Dealing with exceptions
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2804.1362266283.2939.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362266283 news.xs4all.nl 6885 [2001:888:2000:d::a6]:56497
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40375

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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