palewire / django-calaccess-campaign-browser

A Django app to refine, review and republish campaign finance data drawn from the California Secretary of State’s CAL-ACCESS database
http://django-calaccess-campaign-browser.californiacivicdata.org
MIT License
17 stars 12 forks source link

crash from election query problem in scrapecalaccesscampaignpropositions.py #204

Open rkiddy opened 9 years ago

rkiddy commented 9 years ago

I ran the setup commands for raw-data and campaign-browser. These had worked a few days ago.

The full log of the setup and import is at http://opencalaccess.org/ccdc/cb_issue_rrk1_log.txt

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/calaccess_campaign_browser/management/commands/buildcalaccesscampaignbrowser.py", line 16, in handle
    call_command("scrapecalaccesscampaignpropositions")
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 115, in call_command
    return klass.execute(*args, **defaults)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/calaccess_campaign_browser/management/commands/__init__.py", line 33, in handle
    self.process_results(results)
  File "/usr/local/lib/python2.7/dist-packages/calaccess_campaign_browser/management/commands/scrapecalaccesscampaignpropositions.py", line 232, in process_results
    election_type='SPECIAL_RUNOFF'
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 357, in get
    self.model._meta.object_name)
calaccess_campaign_browser.models.DoesNotExist: Election matching query does not exist.
palewire commented 9 years ago

Thanks, I'll take a look at this when I get the time. The scrapers were put together rapidly during a hackathon earlier this year so they need roadtesting like this.

rkiddy commented 9 years ago

Any reason that the scrapecalaccesscampaignpropositions.py command does not have a handle function? I am still trying to grok some of this. I guess a handle function is optional. But it surely is useful in clarifying what the command is doing.

palewire commented 9 years ago

I believe it is because it is a subclass of another class that has that method. Perhaps overengineered.

rkiddy commented 9 years ago

Still happening with newly downloaded data.