Repository: openstates/openstates-scrapers

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

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


```
  05:42:01 INFO billy: Save bill upper 2017-2020: RS0225
05:42:01 INFO billy: Save bill lower 2017-2020: PC0608
05:42:01 INFO billy: Save bill lower 2017-2020: PC1038
05:42:01 INFO billy: Save bill lower 2017-2020: PC0747
05:42:01 INFO billy: Save bill lower 2017-2020: PC0478
05:42:01 INFO billy: Save bill lower 2017-2020: PC0992
05:42:01 INFO billy: Save bill lower 2017-2020: PC1130
05:42:01 INFO billy: Save bill lower 2017-2020: PC0118
05:42:01 INFO billy: Save bill lower 2017-2020: RCC0364
05:42:01 INFO billy: Save bill lower 2017-2020: PC0235
05:42:01 INFO billy: Save bill upper 2017-2020: PS0802
05:42:01 INFO billy: Save bill lower 2017-2020: PC0867
05:42:01 INFO billy: Save bill lower 2017-2020: RKC0071
05:42:01 INFO billy: Save bill lower 2017-2020: RC0051
05:42:01 INFO billy: Save bill lower 2017-2020: PC0649
05:42:01 INFO billy: Save bill lower 2017-2020: PC0957
05:42:01 INFO billy: Save bill lower 2017-2020: RCC0229
05:42:01 INFO billy: Save bill lower 2017-2020: PC0021
05:42:01 INFO billy: Save bill lower 2017-2020: PC0536
05:42:01 INFO billy: Save bill upper 2017-2020: RCS0148
05:42:01 INFO billy: Save bill upper 2017-2020: PS0997
05:42:01 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:
Looks like a data error with a date on the [PR site](http://oslpr.org/legislatura/tl2017/tl_medida_print2.asp?r=P%20S0623&ult=1), testing a fix now.

Resolving patch:
diff --git a/openstates/pr/bills.py b/openstates/pr/bills.py
--- a/openstates/pr/bills.py
+++ b/openstates/pr/bills.py
@@ -139,9 +139,11 @@ def parse_action(self, chamber, bill, action, action_url, date):
                 action_actor = 'lower'
             else:
                 action_actor = chamber
-        # if action.startswith('Referido'):
-            # for comme in committees:
-            # print comme
+
+        # manual fix for data error on 2017-2020 P S0623
+        if date == '8/1/1826':
+            date = '8/1/2018'
+
         bill.add_action(description=action.replace('.', ''),
                         date=date.strftime('%Y-%m-%d'),
                         chamber=action_actor,


Test patch: