Thanks Steve, I appreciate your patience.
On Jan 31, 1:39 am, Steven D'Aprano [EMAIL PROTECTED]
wrote:
If the built-in isn't Unicode aware, subclassing it won't magically make
it so :-)
Oh, I agree. If I have a string mesg that is unicode-not-ascii and I
say
try:
raise Exception mesg
Oops, there is a typo in what I wrote above. Sorry.
On Jan 31, 7:57 am, Jim [EMAIL PROTECTED] wrote:
Oh, I agree. If I have a string mesg that is unicode-not-ascii and I
say
try:
raise Exception mesg
except Exception, err:
print Trouble+mesg
then I have problems.
should
Thank you for the reply. It happens that, as I understand it, none of
the options that you mentioned is a solution for my situation.
On Jan 29, 9:48 pm, Steven D'Aprano [EMAIL PROTECTED]
wrote:
The easiest ways to fix that are:
(1) subclass an exception that already knows about Unicode;
But
(2) convert the file name to ASCII before you store it; or
I need the non-ascii information, though, which is why I included it
in the error message.
Then convert it to utf-8, or some encoding you know it will be used by your
terminal.
Diez
--
On Jan 30, 7:41 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:
(2) convert the file name to ASCII before you store it; or
I need the non-ascii information, though, which is why I included it
in the error message.
Then convert it to utf-8, or some encoding you know it will be used by your
Jim wrote:
On Jan 30, 7:41 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:
(2) convert the file name to ASCII before you store it; or
I need the non-ascii information, though, which is why I included it
in the error message.
Then convert it to utf-8, or some encoding you know it will be
On Jan 30, 8:18 am, Peter Otten [EMAIL PROTECTED] wrote:
try:... raise Exception(ugewöhnlich ähnlich üblich)
... except Exception, e:
... print e.message
...
gewöhnlich ähnlich üblich
Ah, so that's what If there is a single argument (as is preferred),
it is bound to the message
On Tue, 30 Jan 2007 04:34:24 -0800, Jim wrote:
Thank you for the reply. It happens that, as I understand it, none of
the options that you mentioned is a solution for my situation.
On Jan 29, 9:48 pm, Steven D'Aprano [EMAIL PROTECTED]
wrote:
The easiest ways to fix that are:
(1)
Hello,
I'm trying to write exception-handling code that is OK in the
presence
of unicode error messages. I seem to have gotten all mixed up and
I'd
appreciate any un-mixing that anyone can give me.
I'm used to writing code like this.
class myException(Exception):
pass
fn='README'
On Mon, 29 Jan 2007 18:01:56 -0800, Jim wrote:
Hello,
I'm trying to write exception-handling code that is OK in the
presence
of unicode error messages. I seem to have gotten all mixed up and
I'd
appreciate any un-mixing that anyone can give me.
[snip]
class MyException(Exception):
10 matches
Mail list logo