I have a set of scrapers written in python that I'm trying to host on Heroku. I've pushed the repo to heroku, and it will begin to run, but quits with an error I never encountered in my local environment.
when I call p = Legislator(name=name, district=district) where both name and district are strings, I get TypeError: __init__() takes at least 3 arguments (2 given)
both Legislator and Person are included in packages my script is dependent on, both of which are specified in requirements.txt
could this have something to do with virtualenv?
here is the constructor for Legislator:
def __init__(self, name, post_id, party=None, chamber=None, **kwargs):
super(Legislator, self).__init__(name, **kwargs)
self.post_id = post_id
self.party = party
self.chamber = chamber
self._contact_details = []
and the constructor for Person
def __init__(self, name, **kwargs):
super(Person, self).__init__()
self.name = name
self.biography = None
self.summary = None
self.birth_date = None
self.death_date = None
self.image = None
self.gender = None
self.links = []
self.other_names = []
self.extras = {}
self._related = []
self.contact_details = []
for k, v in kwargs.items():
setattr(self, k, v)
super(Person, self).__init__()inside the constructor for Person? It looks like you're trying to make Person inherit from Person. And if there is a good reason to do that, shouldn't it besuper(Person, self).__init__(name)?self, name, post_id, party=None, chamber=None, **kwargs, and you gave it<Legislator instance>, name=name, district=district, then you haven't given it apost_idargument, have you? Isn't that the 3rd missing argument? I'm not sure how you managed to avoid this error in your local environment...