[issue12503] "with" statement error message is more confusing in Py2.7

2020-04-26 Thread Zachary Ware
Zachary Ware added the comment: As 2.7 has reached end-of-life, I'm closing the issue. -- nosy: +zach.ware resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker __

[issue12503] "with" statement error message is more confusing in Py2.7

2011-07-08 Thread Éric Araujo
Éric Araujo added the comment: Could AttributeError be improved to say something like this: AttributeError: type 'type' has no attribute '__enter__' -- nosy: +eric.araujo ___ Python tracker __

[issue12503] "with" statement error message is more confusing in Py2.7

2011-07-06 Thread Benjamin Peterson
Benjamin Peterson added the comment: The message is not inaccurate, but indeed misleading. In wonder what to do considering the traditional message of AttributeError is simply the missing attribute. -- nosy: +benjamin.peterson priority: normal -> low _

[issue12503] "with" statement error message is more confusing in Py2.7

2011-07-05 Thread Ismael Garrido
New submission from Ismael Garrido : Using the "with" statement wrongly results in a confusing error message. Code (originally written by Alex Gaynor): class Timer(object): def __enter__(self): self.start = time.time() def __exit__(self, exc_type, exc_val, tb): print "Se