RockefellerArchiveCenter / scripts

Useful scripts
MIT License
16 stars 5 forks source link

Sub Container failure on box_labels #50

Closed p-galligan closed 4 years ago

p-galligan commented 4 years ago

Describe the bug

The box_labels.py script fails when attempting to get sub containers. I thought it was failing because of digital objects, but the try on line 56 should catch that.

To reproduce

Steps to reproduce the behavior:

  1. Download latest version of script
  2. Run it against a finding aid id 12111

Expected behavior

Get a list of container labels. Script runs successfully.

Error message or screenshots

Administrators-MacBook-Pro:archivessnake pgalligan$ sudo python3 get_labels.py 12111 Traceback (most recent call last): File "get_labels.py", line 77, in LabelPrinter(args.resource).run() File "get_labels.py", line 23, in run container = self.get_containers(obj) File "get_labels.py", line 57, in get_containers top_container = instance.sub_container.top_container File "/usr/local/lib/python3.7/site-packages/asnake/jsonmodel/init.py", line 180, in getattr if isinstance(self._json[key], list) and len(self._json[key]) > 0: KeyError: 'sub_container'

helrond commented 4 years ago

Fixed by 8c1123c3df7166b9bd4090c36e5442b41643c263