Reputation: 73
The code posted here, I tried to compile the program but everytime I do it goves me this traceback:
Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/ceradon/cerabot-rewrite/cerabot/tasks/date_templates.py", line 187, in bot = DateTemplates() File "/home/ceradon/cerabot-rewrite/cerabot/tasks/date_templates.py", line 19, in __init__ super(DateTemplates, self).__init__() File "cerabot/bot.py", line 51, in __init__ self.setup() File "/home/ceradon/cerabot-rewrite/cerabot/tasks/date_templates.py", line 110, in setup self._load_templates() File "/home/ceradon/cerabot-rewrite/cerabot/tasks/date_templates.py", line 61, in _load_templates self._to_date.append(template.get(1).value.lower()) AttributeError: 'DateTemplates' object has no attribute '_to_date'
I'm lost, can anybody help in figuring this out?
Upvotes: 1
Views: 138
Reputation: 50215
When you call super(DateTemplates, self).__init__()
this runs Bot.__init__
which calls self.setup()
which runs DateTemplates.setup()
, however this happens before you initialize self._to_date
and so there is no list to append to yet. Move the super
call in DateTemplates.__init__
to the end of the method and this should work.
Upvotes: 1