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

Python 3.9+ is not supported #39

Open
ynerant opened this issue Jan 13, 2022 · 3 comments
Open

Python 3.9+ is not supported #39

ynerant opened this issue Jan 13, 2022 · 3 comments

Comments

@ynerant
Copy link

ynerant commented Jan 13, 2022

The function base64.encodestring is deprecated since Python 3.1 and was removed in Python 3.9. It is used here:
https://github.com/eea/sparql-client/blob/master/sparql.py#L50

You may use use base64.encodebytes() instead.

@cm3
Copy link

cm3 commented Jun 8, 2022

Temporarily, I edited sparql.py under the path given by pip show sparql-client.
Replacing encodestring to encodebytes solved the error on Python 3.9. Just for your information.
(However, that is used in BASIC authentication https://github.com/eea/sparql-client/blob/master/sparql.py#L421 and I've not tried the code with restricted websites.)

@rjalexa
Copy link

rjalexa commented Jan 16, 2023

Tried @cm3 suggestion but get:

class NameDict(collections.MutableMapping):
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'

Python 3.11
sparql-client 3.8

@cm3
Copy link

cm3 commented Jan 25, 2023

@rjalexa I didn't checked but I found a solution: after import collections, put

if sys.version_info.major == 3 and sys.version_info.minor >= 10:
    from collections.abc import MutableMapping
else:
    from collections import MutableMapping

Reference: https://stackoverflow.com/questions/70943244/attributeerror-module-collections-has-no-attribute-mutablemapping

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

3 participants