Issue31989
Created on 2017-11-09 04:11 by diekhans, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg305933 - (view) | Author: Mark Diekhans (diekhans) | Date: 2017-11-09 04:11 | |
done a setattr on a property gives a very unhelpful error message AttributeError: can't set attribute it neither indicates the name of the attribute that failed or the cause. an error such as "can't set property attribute: the_attr_name" would be far more helpful. |
|||
| msg305934 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2017-11-09 04:49 | |
Usually, all the necessary information is present in the previous line of the traceback:
>>> a.volume = 10
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
a.volume = 10
AttributeError: can't set attribute
I don't seem to recall anyone else having problems with this error message.
|
|||
| msg305935 - (view) | Author: Mark Diekhans (diekhans) | Date: 2017-11-09 04:56 | |
The trackback is not helpful if the attribute name is in a variable. It also doesn't explain why the error occurred. While I would not rate this as a high priority, I don't see an argument for having uninformative error messages. Raymond Hettinger <report@bugs.python.org> writes: > > Raymond Hettinger <raymond.hettinger@gmail.com> added the comment: > > Usually, all the necessary information is present in the previous line of the traceback: > > >>> a.volume = 10 > Traceback (most recent call last): > File "<pyshell#6>", line 1, in <module> > a.volume = 10 > AttributeError: can't set attribute > > I don't seem to recall anyone else having problems with this error message. > > ---------- > nosy: +rhettinger > > _______________________________________ > Python tracker <report@bugs.python.org> > <https://bugs.python.org/issue31989> > _______________________________________ |
|||
| msg305961 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2017-11-09 14:20 | |
This is a duplicate of #27794. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:54 | admin | set | github: 76170 |
| 2017-11-09 14:20:41 | r.david.murray | set | status: open -> closed superseder: setattr a read-only property; the AttributeError should show the attribute that failed messages:
+ msg305961 |
| 2017-11-09 04:56:24 | diekhans | set | messages: + msg305935 |
| 2017-11-09 04:49:15 | rhettinger | set | nosy:
+ rhettinger messages: + msg305934 |
| 2017-11-09 04:11:26 | diekhans | create | |
