Skip to content

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

@rhigman

Description

@rhigman

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions