classification
Title: Exception AttributeError: "'NoneType' object has no attribute
Type: behavior Stage:
Components: Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, mark.dickinson, prime
Priority: normal Keywords:

Created on 2012-06-26 13:05 by prime, last changed 2012-06-26 13:31 by amaury.forgeotdarc. This issue is now closed.

Files
File name Uploaded Description Edit
objectvar.py prime, 2012-06-26 13:05
Messages (3)
msg164073 - (view) Author: Mithilesh Kumar (prime) Date: 2012-06-26 13:05
Behavior of the program changes with number of charaters used in variable name. Attached file shows a simple example.
msg164074 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2012-06-26 13:19
The exception you report looks incomplete:  there should be something after the 'no attribute' saying which attribute lookup failed.

In any case, I don't thing this is a bug.  It sounds like a result of the unpredictability of cleanup order at interpreter shutdown:  you're encountering a situation where the 'Person' reference has already been deleted from the module namespace before the __del__ method for one of the Person instances gets called;  so the 'Person' name lookup in the __del__ method fails.  You could get around this by replacing 'Person' with 'type(self)' in __del__.
msg164075 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-06-26 13:31
See also this warning message: http://docs.python.org/reference/datamodel.html#object.__del__
History
Date User Action Args
2012-06-26 13:31:58amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg164075
2012-06-26 13:19:10mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg164074

resolution: not a bug
2012-06-26 13:05:20primecreate