Open AndreaFurlani opened 2 years ago
Thanks @AndreaFurlani for your feedback and suggestions. At the moment the latest Python version supported is 3.7.
This is what @AndreaFurlani posted, I believe (because editing the appropriate section in webservice.py
worked in conjunction with Python 3.10), formatted correctly for easier pasting:
try:
import sys
from urllib.parse import urlparse, urlunparse, parse_qs, urlencode
from collections.abc import MutableMapping as DictMixin
from collections import OrderedDict
from urllib.request import urlopen
except ImportError:
from urllib.parse import urlparse
from urllib.parse import urlencode
from .odict import OrderedDict
from collections import MutableMapping as DictMixin
from urllib.request import urlopen
Using the last versions of Python it is no more possible to import the Service module of intermine, resulting in the following error:
Traceback (most recent call last): File "<ipython-input-3-b381508e45c3>", line 3, in <module> from UserDict import DictMixin File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) ModuleNotFoundError: No module named 'UserDict' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3251, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-b381508e45c3>", line 9, in <module> from collections import MutableMapping as DictMixin ImportError: cannot import name 'MutableMapping' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)
In the webservice.py file the problems are the following:
Modify the import section as follow solved the problem:
try: import sys from urllib.parse import urlparse, urlunparse, parse_qs, urlencode from collections.abc import MutableMapping as DictMixin from collections import OrderedDict from urllib.request import urlopen except ImportError: from urllib.parse import urlparse from urllib.parse import urlencode from .odict import OrderedDict from collections import MutableMapping as DictMixin from urllib.request import urlopen
Making these changes in the source code will no longer require the intervention of a user to modify it, as it is not possible in all cases.