Re: exceptions and unicode

2010-06-19 Thread Stuart McGraw
On 06/16/2010 03:51 PM, Thomas Jollans wrote: > On 06/16/2010 10:10 PM, Stuart McGraw wrote: >> Note that the exceptions may be anything (I just used IOError >> as an example) and are generated in bowels of an API that I >> can't/won't mess with. > > Yeah, well, you'd have to special-case every

Re: exceptions and unicode

2010-06-19 Thread Stuart McGraw
On 06/16/2010 03:53 PM, Martin v. Loewis wrote: >> So how do I get what I want? > > Submit a patch. You would have to explain why this is a bug fix and not > a new feature, as new features are not allowed anymore for 2.x. Thanks. Actually I have no idea if this is a bug or a feature (despite r

Re: exceptions and unicode

2010-06-16 Thread Martin v. Loewis
So how do I get what I want? Submit a patch. You would have to explain why this is a bug fix and not a new feature, as new features are not allowed anymore for 2.x. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: exceptions and unicode

2010-06-16 Thread Thomas Jollans
On 06/16/2010 10:10 PM, Stuart McGraw wrote: > I am having a problem with exceptions and unicode. > > try: open ('file.txt') > except IOError, e: pass > str (e) > => "[Errno 2] No such file or directory: 'file.txt'" > > which

exceptions and unicode

2010-06-16 Thread Stuart McGraw
I am having a problem with exceptions and unicode. try: open ('file.txt') except IOError, e: pass str (e) => "[Errno 2] No such file or directory: 'file.txt'" which is fine but... try: open (u'フィイル.txt') except IOError, e: pass str (e)

Re: Exceptions and unicode messages

2007-03-21 Thread Tuomas
This seems to work: >>> import sys, traceback >>> def excepthook(exctype, value, tb): ... if tb: ... lines = traceback.format_tb(tb) ... for i, line in zip(range(len(lines)), lines): ... lines[i] = lines[i].decode('utf8') ... lines.insert(0, u'Traceback (

Re: Exceptions and unicode messages

2007-03-21 Thread kyosohma
On Mar 21, 6:03 am, Tuomas <[EMAIL PROTECTED]> wrote: > This works: > >>> raise StandardError(u'Wrong type') > Traceback (most recent call last): >File "", line 1, in ? > StandardError: Wrong type > > but don't in Finnish: > >>> raise StandardError(u'Väärä tyyppi') > Traceback (most recent ca

Re: Exceptions and unicode messages

2007-03-21 Thread kyosohma
On Mar 21, 6:03 am, Tuomas <[EMAIL PROTECTED]> wrote: > This works: > >>> raise StandardError(u'Wrong type') > Traceback (most recent call last): >File "", line 1, in ? > StandardError: Wrong type > > but don't in Finnish: > >>> raise StandardError(u'Väärä tyyppi') > Traceback (most recent ca

Re: Exceptions and unicode messages

2007-03-21 Thread manish kurup
Hey anybody please tell me... How we can get the properties of a file in python On 3/21/07, Tuomas <[EMAIL PROTECTED]> wrote: This works: >>> raise StandardError(u'Wrong type') Traceback (most recent call last): File "", line 1, in ? StandardError: Wrong type but don't in Finnish: >>> r

Exceptions and unicode messages

2007-03-21 Thread Tuomas
This works: >>> raise StandardError(u'Wrong type') Traceback (most recent call last): File "", line 1, in ? StandardError: Wrong type but don't in Finnish: >>> raise StandardError(u'Väärä tyyppi') Traceback (most recent call last): File "", line 1, in ? StandardError>>> >>> Any solution