Re: [Tutor] question about try & except

2005-10-27 Thread Kent Johnson
w chun wrote: > if your app is willing to tolerate errors/crashes, then i would take > alan's advice and just letting the errors happen, as opposed to being > so careful with (and integrating Kent's suggestion for the full > traceback with): > > try: > BLOCK > except Exception, e: > print

Re: [Tutor] question about try & except

2005-10-27 Thread w chun
On 10/26/05, nephish <[EMAIL PROTECTED]> wrote: > Yeah, cool. i am just starting this part. > i am glad i started with python. > thanks for the help if your app is willing to tolerate errors/crashes, then i would take alan's advice and just letting the errors happen, as opposed to being so carefu

Re: [Tutor] question about try & except

2005-10-27 Thread Kent Johnson
nephish wrote: > Hey there, > i am writing some (for me) pretty complicated stuff for work that > really needs to work. > i have looked at exception handling in the Learning Python book. > and i am using some try / except statements. > the problem is, that even though my script

Re: [Tutor] question about try & except

2005-10-27 Thread Alan Gauld
> and i am using some try / except statements. > the problem is, that even though my script does not crash, i dont know > the exact error. IT sounds like your try/except is masking the error. Its usually a good idea to NOT Use try/except when developing your code, then go back and put it in whe

Re: [Tutor] question about try & except

2005-10-26 Thread nephish
Yeah, cool. i am just starting this part. i am glad i started with python. thanks for the help sk On Wed, 2005-10-26 at 21:32 -0700, w chun wrote: > > i am writing some (for me) pretty complicated stuff for work that > > really needs to work. > > i have looked at exception handlin

Re: [Tutor] question about try & except

2005-10-26 Thread w chun
> i am writing some (for me) pretty complicated stuff for work that > really needs to work. > i have looked at exception handling... > and i am using some try / except statements. > the problem is, that even though my script does not crash, i dont know > the exact error. >

Re: [Tutor] question about try & except

2005-10-26 Thread nephish
Thanks Hugo, Now that i know where to look appreciate your help. -sk On Wed, 2005-10-26 at 21:27 -0600, Hugo González Monteverde wrote: > Yes, > > You can catch an error object along with the exception, as in: > > try: > fileo = open("nofile") > except IOError, e: > print "Alas...

Re: [Tutor] question about try & except

2005-10-26 Thread Hugo González Monteverde
Yes, You can catch an error object along with the exception, as in: try: fileo = open("nofile") except IOError, e: print "Alas...", e As you see, the error object has a string representation equal wo what normally the python interpreter prints... >>> Alas... [Errno 2] No such file o