Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.048 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'append': 0.09; 'happen,': 0.09; "'w'": 0.16; 'earlier.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:issue': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'written': 0.21; 'otherwise,': 0.22; 'load': 0.23; 'error': 0.23; 'him.': 0.24; 'earlier': 0.24; 'header:In-Reply-To:1': 0.27; 'record': 0.27; 'mode': 0.30; 'message-id:@mail.gmail.com': 0.30; 'sep': 0.31; 'file': 0.32; 'open': 0.33; "i'd": 0.34; 'agree': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'handle': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'anything': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'dave': 0.60; 'first': 0.61; 'helping': 0.70; 'wipe': 0.84; 'angel': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=E87egP+CVFh7kp5zaVJtmO6kTyjww/kHoF2JFuSqIIQ=; b=0yszVEV4cJWtBec2LjlFZ30jIvZCz2xD0oj4iwvzC8/eF9LFJueY3HT/QRszMn7KDA cYvHv2uN5eG35q2/63YEiElxl66T3N3lSBb79J2nE87vlDX0kts8FkatiC9M4Xd1KE/P 2441iLhpZc9uEcCC93RfFbEInrHCxjf6xtW48XS1d0lbcJflaFNLIyhI5s0o5HINAltV JTWXCRDIcBCeuUDNdTAl9lmqzwRHSGIvbCYC0tZ1dprLSvhIN29TGAOnz/USmFUeSfnQ XYwO9oFUSkvYXReeOJWKn8okP9/52zAkrTeu5wU9Bj8Uhx21MUbGS5Og8dRx8jWhMMnF cmTQ== MIME-Version: 1.0 X-Received: by 10.220.10.194 with SMTP id q2mr17248537vcq.2.1378032670627; Sun, 01 Sep 2013 03:51:10 -0700 (PDT) In-Reply-To: References: Date: Sun, 1 Sep 2013 20:51:10 +1000 Subject: Re: UnicodeDecodeError issue 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378032678 news.xs4all.nl 15949 [2001:888:2000:d::a6]:45351 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53409 On Sun, Sep 1, 2013 at 8:35 PM, Dave Angel wrote: > Your file mode is 'w' which will wipe out anything written earlier. Yet > if the exception does not happen, the file will still contain error(s) > from some earlier run. You should open (and truncate) the file before > the first use, then use the same handle in each exception at which you > want to record any information. Hmm, I'd go the other way, and append to the file every time there's an error - otherwise, one successful page load will wipe out the error from a previous one. But I agree that the inconsistency is not helping him. ChrisA