pzrq's post says to use:
str(e)
This was exactly what I needed.
(If you are in a unicode environment, it appears that:
unicode(e)
will work, and it appears to work fine in a non-unicode environment)
Pzrq said a lot of other good stuff, but I almost missed their answer due to all the good stuff. Since I don't have 50 points I cannot comment on their answer to attempt to draw attention to the simple solution that works, and since I don't have 15 I cannot vote that answer up, but I can post (feels backward, but oh well) - so here I am posting - probably lose points for that...
Since my point is to draw attention to pzrq's answer, please don't glaze over and miss it in all the below. the first few lines of this post are the most important.
My story:
The problem I came here for was if you want to catch an exception from a class that you have no control over - what then??? I'm certainly not going to subclass all possible classes my code uses in an attempt to be able to get a message out of all possible exceptions!
I was using:
except Exception as e:
print '%s (%s)' % (e.message,type(e))
which, as we all now know, gives the warning OP asked about (which brought me here), and this, which pzrq gives as a way to do it:
except Exception as e:
print '%s (%s)' % (str(e),type(e))
did not.
I'm not in a unicode environment, but jjc's answer made me wonder, so I had to try it. In this context this becomes:
except Exception as e:
print '%s (%s)' % (unicode(e),type(e))
which, to my surprise, worked exactly like str(e) - so now that's what I'm using.
Don't know if 'str(e)/unicode(e)' is the 'approved Python way', and I'll probably find out why that's not good when I get to 3.0, but one hopes that the ability to handle an unexpected exception (*) without dying and still get some information from it won't ever go away...
(*) Hmm. "unexpected exception" - I think I just stuttered!