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

ckan_pycsw.py cannot run on Python 3.2 or greater #299

Open
frafra opened this issue Nov 5, 2022 · 1 comment
Open

ckan_pycsw.py cannot run on Python 3.2 or greater #299

frafra opened this issue Nov 5, 2022 · 1 comment

Comments

@frafra
Copy link
Contributor

frafra commented Nov 5, 2022

  File "/usr/lib/ckan/venv/src/ckanext/ckanext-spatial/bin/ckan_pycsw.py", line 27, in setup_db
    table_name = pycsw_config.get("repository", "table", "records")
TypeError: get() takes 3 positional arguments but 4 were given

Changed in version 3.2: Arguments raw, vars and fallback are keyword only to protect users from trying to use the third argument as the fallback fallback (especially when using the mapping protocol).
-- https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.get

@etj
Copy link
Contributor

etj commented Dec 7, 2022

It could be fixed using

    table_name = pycsw_config.get("repository", "table", fallback="records")

but you also need to import configparser, also to prevent the warning about the deprecation of the old parser:

DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2.

If you need to use env vars in the config file you also need to import EnvInterpolation from the related pycsw package and init the config in this way:

config = configparser.ConfigParser(interpolation=EnvInterpolation())

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

2 participants