Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; "'a'": 0.09; 'strings.': 0.09; 'valueerror:': 0.09; 'python': 0.11; 'keyerror': 0.16; 'subject:Unicode': 0.16; 'valueerror': 0.16; 'seems': 0.21; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'instance,': 0.24; 'unicode': 0.24; 'raise': 0.29; 'unix': 0.29; "doesn't": 0.30; "i'm": 0.30; '"",': 0.31; 'exceptions': 0.31; 'keyerror:': 0.31; 'file': 0.32; '(most': 0.33; 'problem': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'machine.': 0.36; 'hi,': 0.36; 'handle': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'content-disposition:inline': 0.62; 'anything.': 0.68; 'hand': 0.80 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:content-transfer-encoding:user-agent; bh=y5MgImUZ1em1/w6mF+6ZBtgsE9dUBGGLMXNNljezGsU=; b=A4Md/amJFQJWhRSD1297XAbtEP2BqclcUinqtsfhVWN3C91SiZ4oVA2eEOhurS7Rhz oBqD6QZC5NzRG2DT/W7Mzl5qotuaGOJQz4zxFR8AbtbyB6kL2u3dM2FlCVLRI349M6PB iwf1SSMJ9nJvEulLniX4Wmk8F6aa5twyGPkttAAeQegWETfZkk+Lbq5Z3F6LbzLNYtEu 6RtvgaRdK9ikUTVlxERZZtb+1DFTHe0l3r6w9kbD786/AmlPLueC4GWiMBfbWlMVYJX0 XhZmj1w/X/stGTcOZdMGpsgPsmnPb+iriYZ8NaOmIogLnslUqyEGvQX7EaYnP0/Tapoa aLYg== X-Received: by 10.180.99.74 with SMTP id eo10mr7993778wib.12.1389875653046; Thu, 16 Jan 2014 04:34:13 -0800 (PST) Date: Thu, 16 Jan 2014 13:34:08 +0100 From: Ernest =?iso-8859-1?Q?Adrogu=E9?= To: python-list@python.org Subject: Unicode strings as arguments to exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Operating-System: GNU/Linux (Debian jessie/sid) User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Thu, 16 Jan 2014 13:52:39 +0100 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389876759 news.xs4all.nl 2976 [2001:888:2000:d::a6]:46940 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64077 Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. For instance, KeyError seems to not have a problem with them >>> raise KeyError('a') Traceback (most recent call last): File "", line 1, in KeyError: 'a' >>> raise KeyError(u'=E4') Traceback (most recent call last): File "", line 1, in KeyError: u'\xe4' On the other hand ValueError doesn't print anything. >>> raise ValueError('a') Traceback (most recent call last): File "", line 1, in ValueError: a >>> raise ValueError(u'=E4') Traceback (most recent call last): File "", line 1, in ValueError I'm using Python 2.7.6 on a Unix machine.