Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for files on compound objects. #16

Merged

Conversation

markpbaggett
Copy link
Collaborator

@markpbaggett markpbaggett commented Sep 19, 2024

This attempts to fix:

Traceback (most recent call last):
  File "/Users/westonagreda/Library/Caches/pypoetry/virtualenvs/utk-exodus-xBCLoTSd-py3.11/bin/exodus", line 6, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/westonagreda/Library/Caches/pypoetry/virtualenvs/utk-exodus-xBCLoTSd-py3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Library/Caches/pypoetry/virtualenvs/utk-exodus-xBCLoTSd-py3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Library/Caches/pypoetry/virtualenvs/utk-exodus-xBCLoTSd-py3.11/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Library/Caches/pypoetry/virtualenvs/utk-exodus-xBCLoTSd-py3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Library/Caches/pypoetry/virtualenvs/utk-exodus-xBCLoTSd-py3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Documents/utkdigitalinitiatives/utk-exodus/utk_exodus/exodus.py", line 146, in works_and_files
    interface.download_mods(collection, model)
  File "/Users/westonagreda/Documents/utkdigitalinitiatives/utk-exodus/utk_exodus/controller/controller.py", line 152, in download_mods
    self.__grab_file_info()
  File "/Users/westonagreda/Documents/utkdigitalinitiatives/utk-exodus/utk_exodus/controller/controller.py", line 78, in __grab_file_info
    x = FileOrganizer("tmp/works.csv", ["filesets", "attachments"], self.remote)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Documents/utkdigitalinitiatives/utk-exodus/utk_exodus/finder/finder.py", line 17, in __init__
    self.new_csv_with_files = self.__add_files(what_to_add)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Documents/utkdigitalinitiatives/utk-exodus/utk_exodus/finder/finder.py", line 200, in __add_files
    new_csv_content.append(self.__add_an_attachment(dsid, row))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Documents/utkdigitalinitiatives/utk-exodus/utk_exodus/finder/finder.py", line 74, in __add_an_attachment
    'rdf_type': RDFTypeGenerator(row['model']).find_file_types(filename, preserve_and_obj),
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/westonagreda/Documents/utkdigitalinitiatives/utk-exodus/utk_exodus/finder/finder.py", line 263, in find_file_types
    raise Exception(f"Parent type unknown: {self.parent_type}")
Exception: Parent type unknown: CompoundObject

It's hard for me to test this, and there aren't built in unit tests for finder, FileOrganizer, etc. I'd try fetching and checking this out before merging any thing here. Do something like:

gh pr checkout 16

Then running the command that generated. If everything works, great, but there might be another thing that gets thrown that might need to be fixed. Happy to review this together over a Zoom call or Slack huddle.

@Weston49
Copy link
Collaborator

Tested this on the collection that was throwing this error and it seems to have fixed it, sheets for that collection are now generated.

@Weston49 Weston49 merged commit d13173c into utkdigitalinitiatives:main Sep 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants