Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'filename': 0.07; 'shutil': 0.07; 'terry': 0.09; 'experiment.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'generate,': 0.16; 'reedy': 0.16; 'wrote:': 0.17; 'file.': 0.20; '"",': 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; '>>>>': 0.29; "skip:' 10": 0.30; 'error': 0.30; 'file': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; '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; 'bad': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'description': 0.39; 'to:addr:python.org': 0.39; '2013': 0.84; 'directory:': 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=TVPUNmZxpjU5APbHs9oeoFsAq6b8tCqIT2YUXFuPdyI=; b=Fi2bX1gU4iM3BJ9CRJz+bOKoVp5xp5f1+aCsLW/jPfsJLkmfodvBSYMe2mHGLXzqiR JFuy5vzwOPsIoRW3OlmKDVECgUuMpwzex6ja427LrjoOLeXCqzB8WdU0dyBCfxd0cEWT WNgoez5rnFHD6vOpcPvd3ElhCFd1MpSezpjNoClxK+/0qvg/4LSeIzp86+SM91S0YTTi x4OuSC5raF5NwrK2l7zvFbZJ/pCUrWjyC/gG8NqmZvOfUiC/13mCfyQTmx2RMcPmVP/8 9mtEzv1XvxnPeq+AirTUT/yUfqZMwtHyd9shQxaJqnBDpG1MVx6e+pElCJu/1KXwggiA s3iw== MIME-Version: 1.0 X-Received: by 10.52.67.164 with SMTP id o4mr5046379vdt.42.1362262611189; Sat, 02 Mar 2013 14:16:51 -0800 (PST) In-Reply-To: References: <707df78f-9a67-4ce1-8dd3-095c75a7f7da@googlegroups.com> Date: Sun, 3 Mar 2013 09:16:51 +1100 Subject: Re: Dealing with exceptions From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362262619 news.xs4all.nl 6894 [2001:888:2000:d::a6]:35674 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40368 On Sun, Mar 3, 2013 at 8:23 AM, Terry Reedy wrote: >>>> open('sdjhfjshdfkjsh') > Traceback (most recent call last): > File "", line 1, in > 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. ChrisA