Context Manager getting str instead of AttributeError instance

Prasad, Ramit ramit.prasad at
Thu Mar 15 21:25:46 CET 2012

> > ...
> > (<type 'exceptions.AttributeError'>, "'A' object has no attribute 'x'",
> <traceback object at 0x1817F648>)
> > AttributeError: 'A' object has no attribute 'x'
> >
> > As you can see, I am getting a string while you are not.
>Ian Kelly said: 
> Looks like a version difference.  I don't have Python 2.6 handy to
> test on, but I get a str in Python 2.5 and an AttributeError instance
> in Python 2.7.

Thanks Ian, that was the key! I guess I will just have to work around it.
Any suggestions? I am thinking about just creating a blank instance of 
the error class since that the class gets passed successfully.


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at  

More information about the Python-list mailing list