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

pycsw 2.6.1 (latest release) requires the deprecated "imp" library which is no longer available in python 3.12 #1013

Open
2 of 8 tasks
mirandadam opened this issue Sep 11, 2024 · 0 comments

Comments

@mirandadam
Copy link

Description

PyCSW 2.6.1 (latest release, from oct/2021) requires the deprecated "imp" library which is no longer available in Python 3.12
The master branch has already dropped that dependency on the "server.py" file, so no patch is necessary. This issue will be solved with a release of 3.0 which seems to be in the works.

Environment

  • operating system: all
  • Python version: 3.12
  • pycsw version: 2.6.1
  • source/distribution
    • git clone
    • DebianGIS/UbuntuGIS
    • PyPI
    • zip/tar.gz
    • other (please specify):
  • web server
    • Apache/mod_wsgi
    • CGI
    • other (please specify): geonode backend when trying to use python 3.12.

Steps to Reproduce

Run a container with the latest python version:

$ podman run -it --rm python:latest bash

Inside the container, install the required packages and launch a python console:

$ pip install setuptools pycsw==2.6.1 #latest version as of 2024-09-11
$ python

In the python shell run the following:

from pycsw import server
import os

os.environ['QUERY_STRING'] = "fake query"

# dummy configuration dictionary. It is important to have a "mappings" section in "repository" to trigger the invalid import.
config = {
    'server': {
        'home': '.',
        'url': 'http://localhost:8000',
        'mimetype': 'application/xml; charset=UTF-8',
        'encoding': 'UTF-8',
        'language': 'en-US',
        'maxrecords': '10',
    },
    'repository': {
        'database': 'sqlite:///data.db',
        'table': 'records',
        'mappings': 'path/to/your/mappings.py'
    }
}

# Instantiate pycsw object
csw = server.Csw(rtconfig=config)

Running the code above will generate the following error message:

Could not load custom mappings: No module named 'imp'
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pycsw/server.py", line 194, in __init__
    import imp
ModuleNotFoundError: No module named 'imp'

Additional Information

This issue will be solved with a release of 3.0 which seems to be in the works.

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