Repository: openstates/openstates-scrapers

Issue:
PR failing since at least 2018-09-07
PR has been failing since 2018-09-07

Based on automated runs it appears that PR has not run successfully in 7 days (2018-09-07).


```
  05:46:18 INFO billy: Save bill lower 2017-2020: RC0611
05:46:18 INFO billy: Save bill lower 2017-2020: RC0495
05:46:18 INFO billy: Save bill lower 2017-2020: RC0924
05:46:18 INFO billy: Save bill lower 2017-2020: PC0827
05:46:18 INFO billy: Save bill upper 2017-2020: RS0659
05:46:18 INFO billy: Save bill upper 2017-2020: PS0818
05:46:18 INFO billy: Save bill upper 2017-2020: RCS0208
05:46:18 INFO billy: Save bill lower 2017-2020: RC0020
05:46:18 INFO billy: Save bill lower 2017-2020: RC0473
05:46:18 INFO billy: Save bill lower 2017-2020: RC0292
05:46:18 INFO billy: Save bill lower 2017-2020: RC0755
05:46:18 INFO billy: Save bill lower 2017-2020: RKC0061
05:46:18 INFO billy: Save bill lower 2017-2020: PC1210
05:46:18 INFO billy: Save bill upper 2017-2020: RS0745
05:46:18 INFO billy: Save bill lower 2017-2020: PC0253
05:46:18 INFO billy: Save bill lower 2017-2020: RCC0346
05:46:18 INFO billy: Save bill lower 2017-2020: RCC0364
05:46:18 INFO billy: Save bill lower 2017-2020: PC0310
05:46:18 INFO billy: Save bill lower 2017-2020: PC0392
05:46:18 INFO billy: Save bill upper 2017-2020: RCS0017
05:46:18 INFO billy: Save bill upper 2017-2020: RCS0191
05:46:18 INFO billy: Save bill upper 2017-2020: PS0623
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, 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 "/opt/openstates/openstates/pupa2billy/run.py", line 39, in <module>
    bs.scrape()
  File "pupa2billy/bills.py", line 51, in scrape
    self.process_bill(bill)
  File "pupa2billy/bills.py", line 114, in process_bill
    self.save_bill(bill)
  File "/opt/openstates/venv-billy/src/billy/billy/scrape/__init__.py", line 196, in save_object
    json.dump(obj, f, cls=JSONEncoderPlus)
  File "/usr/lib/python2.7/json/__init__.py", line 189, in dump
    for chunk in iterable:
  File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
    o = _default(o)
  File "/opt/openstates/venv-billy/src/billy/billy/utils/__init__.py", line 65, in default
    return time.mktime(obj.timetuple())
ValueError: year out of range
```

Visit http://bobsled.openstates.org for more info.



Discussion:

Resolving patch:
diff --git a/openstates/pr/bills.py b/openstates/pr/bills.py
--- a/openstates/pr/bills.py
+++ b/openstates/pr/bills.py
@@ -141,8 +141,8 @@ def parse_action(self, chamber, bill, action, action_url, date):
                 action_actor = chamber
 
         # manual fix for data error on 2017-2020 P S0623
-        if date == '8/1/1826':
-            date = '8/1/2018'
+        if date == datetime.datetime(1826, 8, 1):
+            date = date.replace(year=2018)
 
         bill.add_action(description=action.replace('.', ''),
                         date=date.strftime('%Y-%m-%d'),


Test patch: