Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21710

RE: Context Manager getting str instead of AttributeError instance

From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
Subject RE: Context Manager getting str instead of AttributeError instance
Date 2012-03-15 20:25 +0000
References <5B80DD153D7D744689F57F4FB69AF474026B9264@SCACMX008.exchad.jpmchase.net> <jjte9l$4iq$1@dough.gmane.org> <5B80DD153D7D744689F57F4FB69AF474026B9625@SCACMX008.exchad.jpmchase.net> <CALwzid=O78BW2yqh6_4pSAVVXuSxqM5GVzXdhyPnLY7KUWvbaQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.700.1331843179.3037.python-list@python.org> (permalink)

Show all headers | View raw


> > ...
> > (<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


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 http://www.jpmorgan.com/pages/disclosures/email.  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: Context Manager getting str instead of AttributeError instance "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-03-15 20:25 +0000

csiph-web