I do the following assignment (File is a class):
file_object = File()
file_object.file_type = file_type
and I get:
AttributeError: 'File' object has no attribute 'file_type'
How can it be?
I thought, that you could add attributes dynamically (and it worked always before).
I've upgraded my python to 2.7.13, and now I have this problem.
File
(in my case) has __dict__
and does not have __slot__
:
>>> print dir(File)
['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'factory', 'method_name']