#python - Sat 24 Feb 2007 between 00:12 and 00:31

NY Lost Funds



yuriksHey
josepharmbrusterhey
SiCuTDeUxis there something like cpan for python?
crackiwhat do you wanna find?
SiCuTDeUxsomething to work with irc
crackiwhat were your search results?
SiCuTDeUxnon, i haven't look for it
josepharmbrusterSiCuTDeUx: you may want to touch base with SpComb, he's working on a new interface for IRC with Twisted
crackido that then
SiCuTDeUxjust asking before searching
JohnQExceptions....
josepharmbrusterSiCuTDeux: check with SpComb. . . Trust me :-) he's Very Well into this... he would know best
JohnQI am about to use a class which has about 10 different types of exceptions it can raise...
How can I catch them, and print a nice message to the user with more information than "exception raised" without having to explicitly handle each one seperately?
crackiraise FooException("something happened")
josepharmbrustercan you use the Exception.message attribute?
JohnQMaybe.. Im not sure how to do it though... I cant seem to find much about this type of exception handling in my books though.
josepharmbrusterJohnQ: are you simply looking to catch all exceptions in one except block and be able to pull out detail?
JohnQYes
josepharmbrusteri would just do a simple: except Exception, message: print message
something to that effect should be sufficient for what you need
JohnQah I see
josepharmbrusterif that's good for you, i'm off to bed :-)
JohnQIt should be...
But is there a way to find the execption type that was raised too?
KirkMcDonaldtype(message), I would think.
JohnQthat would be str
josepharmbrustercorrect, that would be string
CVirushow can I insert type(foo) in an if statement ?
JohnQif type(foo) = str:
==
KirkMcDonaldisinstance(foo, basicstring)
Err
basestring?
Yeah, isinstance(foo, basestring)
CVirusJohnQ: never thought this would work ... thanks
josepharmbrusterwait, did you want to find the exception type?
i'm confused
JohnQIm looking to print something like: "ZeroDivisionError : integer division or modulo by zero"
not just the second half

Page: 2 9 16 23 30 37 44 51 58 65 

IrcArchive

NY Lost Funds