Re: [Tutor] Nicer error message

2011-05-31 Thread Alan Gauld
"Válas Péter" wrote You could write directly to sys.stderr instead of raising an error. Or better still do both. But only at the top level of your program. > If other programmers have to work with your code, they'll probably > find this _incredibly_ annoying. You mean there is no way to wr

Re: [Tutor] Nicer error message

2011-05-31 Thread Válas Péter
2011/5/31 Steven D'Aprano > > Tracebacks are intended to be *useful*, not "nice". Nobody ever said, "Oh > look, what a pretty error message! OK, I just saw how nice builtin exceptions were, and went envying them. :-) ___ Tutor maillist - Tutor@pytho

Re: [Tutor] Nicer error message

2011-05-31 Thread Válas Péter
2011/5/31 Steven D'Aprano > You should inherit exceptions from the Exception class: > OK, as a matter of fact, it was not Error, it was the own error class of a bigger program, I just wanted to substitute it with the root object by heart, and I was wrong, sorry. > Only built-in exceptions don't

Re: [Tutor] Nicer error message

2011-05-31 Thread Steven D'Aprano
Válas Péter wrote: 2011. május 31. 16:39 Japhy Bartlett írta, : You could write directly to sys.stderr instead of raising an error. If other programmers have to work with your code, they'll probably find this _incredibly_ annoying. You mean there is no way to write it nicely? Or are error m

Re: [Tutor] Nicer error message

2011-05-31 Thread Steven D'Aprano
Válas Péter wrote: Hi, my code is (Python 2.5): class SomeError(Error): """Uff!""" raise SomeError, "blahblah" Screen result: __main__.SomeError: "blahblah" I get Traceback (most recent call last): File "", line 1, in NameError: name 'Error' is not defined How can I make "__main__

Re: [Tutor] Nicer error message

2011-05-31 Thread Válas Péter
2011. május 31. 16:39 Japhy Bartlett írta, : > You could write directly to sys.stderr instead of raising an error. > > If other programmers have to work with your code, they'll probably > find this _incredibly_ annoying. > You mean there is no way to write it nicely? Or are error messages not int

[Tutor] Nicer error message

2011-05-31 Thread Válas Péter
Hi, my code is (Python 2.5): class SomeError(Error): """Uff!""" raise SomeError, "blahblah" Screen result: __main__.SomeError: "blahblah" How can I make "__main__" disappear from output? Thanks ___ Tutor maillist - Tutor@python.org To unsubscribe