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

SWORDv2 Python client not compatible with Python 3.12, crashes disseminator.py #45

Open
rhigman opened this issue Nov 8, 2024 · 0 comments

Comments

@rhigman
Copy link
Member

rhigman commented Nov 8, 2024

If attempting to run disseminator.py under Python 3.12, the following error is raised:

Traceback (most recent call last):
  File "/home/rh/code/thoth-dissemination/./disseminator.py", line 19, in <module>
    from culuploader import CULUploader
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rh/code/thoth-dissemination/culuploader.py", line 7, in <module>
    from dspaceuploader import DSpaceUploader, MetadataProfile
  File "/home/rh/code/thoth-dissemination/dspaceuploader.py", line 6, in <module>
    from swordv2uploader import SwordV2Uploader, MetadataProfile
  File "/home/rh/code/thoth-dissemination/swordv2uploader.py", line 8, in <module>
    import sword2
  File "/home/rh/code/thoth-dissemination/.venv/lib/python3.12/site-packages/sword2/__init__.py", line 4, in <module>
    from .service_document import ServiceDocument
  File "/home/rh/code/thoth-dissemination/.venv/lib/python3.12/site-packages/sword2/service_document.py", line 53, in <module>
    from .sword2_logging import logging
  File "/home/rh/code/thoth-dissemination/.venv/lib/python3.12/site-packages/sword2/sword2_logging.py", line 8, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'

This is because the imp module (used by the SWORDv2 client, which is currently used by the CUL workflow) is no longer supported under Python 3.12.

This error is hit even if the CUL platform is selected, because all of the modules are imported regardless.

The error is not hit if running with Docker, presumably because the Dockerfile is currently configured to use Python 3.10.

FROM python:3.10

If we wanted to upgrade the Python version in the Dockerfile in future, we would need to work around this. The SWORDv2 client is not under active development, so its use of the unsupported module is unlikely to be fixed. (One option would be to switch to using a more active fork of the client, or create/manage our own.)

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

No branches or pull requests

1 participant