swsnu / swppfall2017

22 stars 17 forks source link

[HW1] JsonCrawler initializing #18

Open yoongaemii opened 7 years ago

yoongaemii commented 7 years ago

In __init__ method of JsonCrawler, I wonder what below code block does

super(JsonCrawler, self).__init__()

one more thing, while initializing JsonCrawler instance I assigned the 'active' attribute, but if I run the code it turns out to have an AttributeError like

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/Users/hyunyoungyoon/developement/swppfall2017/hw1/python/crawler.py", line 37, in run
    del self.crawlers[self.name]
AttributeError: 'JsonCrawler' object has no attribute 'active'
dj-shin commented 7 years ago
  1. super(JsonCrawler, self).__init__() is for initializing the parent class of JsonCrawler (For detailed information, check out https://stackoverflow.com/questions/3694371/how-do-i-initialize-the-base-super-class). You don't need to understand about class inheritance in this homework.
  2. Check whether your added code is in the correct location of the skeleton code. self.start() should be the very last line of the __init__ method.
dj-shin commented 7 years ago

I've modified your question a bit in order to prevent spoiler. If you want to ask questions regarding your implementation, please ask personally via email :slightly_smiling_face:.