Re: [Tutor] How to raise error without the stack trace

2011-11-29 Thread Steven D'Aprano
Karim wrote: I did not explain myself clearly. I Kow when I fired it because it is in code like: If not value: raise MyError('You did wrong here!') And in that case I did not want the stack trace because I know perfectly where the message is triggered. Really? You must have amazingly

Re: [Tutor] How to raise error without the stack trace

2011-11-27 Thread Alan Gauld
On 27/11/11 12:11, Karim wrote: I just wanted to know if it is possible to control the stack trace display when raising my own exception. No, and you should not try. You can control the stacktrace display where you catch it, but not where you raise it. And that's the point, you are raising i

Re: [Tutor] How to raise error without the stack trace

2011-11-27 Thread Karim
Le 26/11/2011 15:20, Rich Lovely a écrit : On 26 November 2011 11:41, Steven D'Aprano wrote: Hugo Arts wrote: On Sat, Nov 26, 2011 at 11:16 AM, Karim wrote: Hello, I want to fire my own exception without having the (useful but ugly in my case) stack trace display. How to modify a Exception

Re: [Tutor] How to raise error without the stack trace

2011-11-26 Thread Rich Lovely
On 26 November 2011 11:41, Steven D'Aprano wrote: > Hugo Arts wrote: >> >> On Sat, Nov 26, 2011 at 11:16 AM, Karim wrote: >>> >>> Hello, >>> >>> I want to fire my own exception without having the (useful but ugly in my >>> case) stack trace display. >>> >>> How to modify a Exception type class fo

Re: [Tutor] How to raise error without the stack trace

2011-11-26 Thread Steven D'Aprano
Hugo Arts wrote: On Sat, Nov 26, 2011 at 11:16 AM, Karim wrote: Hello, I want to fire my own exception without having the (useful but ugly in my case) stack trace display. How to modify a Exception type class for that purpose which looks like: classs MyError(Exception): pass Cheers Ka

Re: [Tutor] How to raise error without the stack trace

2011-11-26 Thread Peter Otten
Karim wrote: > I want to fire my own exception without having the (useful but ugly in > my case) stack trace display. Printing the stack trace is part of the standard exception handling. For an uncaught exception python will call sys.excepthook which in turn will print the traceback unless you

Re: [Tutor] How to raise error without the stack trace

2011-11-26 Thread Hugo Arts
On Sat, Nov 26, 2011 at 11:16 AM, Karim wrote: > > Hello, > > I want to fire my own exception without having the (useful but ugly in my > case) stack trace display. > > How to modify a Exception type class for that purpose which looks like: > > classs MyError(Exception): >       pass > > Cheers >

[Tutor] How to raise error without the stack trace

2011-11-26 Thread Karim
Hello, I want to fire my own exception without having the (useful but ugly in my case) stack trace display. How to modify a Exception type class for that purpose which looks like: classs MyError(Exception): pass Cheers Karim ___ Tutor mai