sys.exc_info() into string
Magnus
spammers.do.not.bother at void.bogus
Mon Jun 24 10:28:12 EDT 2002
More information about the Python-list mailing list
Mon Jun 24 10:28:12 EDT 2002
- Previous message (by thread): sys.exc_info() into string
- Next message (by thread): Embedding in Tkinter (reprise)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Peter Hansen wrote: > Magnus wrote: >> >> in my program I am catching exceptions that I might have missed by using >> something like: >> >> try: >> doMyStuff() >> except: >> type = sys.exc_info()[0] >> syslog.syslog(syslog.LOG_EMERG, "My program: unexpected error" + >> type) >> >> The thing is that I can not figure out how to make "type" into a string >> above so I can use it for e.g. syslog(). Is there an easy way of doing >> this? > > try: > 1/0 > except Exception, ex: > print "Error: %s" % ex > > Good enough?? > > -Peter Thanks both of you. I'm still learning Python and issues that are trivial to solve for some isn't trivial for me yet. I'm converting from C++ and Java and perhaps in a few months I might be a more experienced Python programmer. Thanks, Magnus
- Previous message (by thread): sys.exc_info() into string
- Next message (by thread): Embedding in Tkinter (reprise)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list