You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run-time warning about import from 'collections'. #19
$ python3 -m csv2wiki -c some_config_file some_data.csv
/usr/lib/python3/dist-packages/html5lib/_trie/_base.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Mapping
...
(the run itself went fine and was successful)
I haven't done much research yet, but cursory searching shows others have encountered and easily resolved it:
In our case, I'm not sure exactly where the warning is coming from. As printed, it's in core Python (which is odd, to say the least), and indeed /usr/lib/python3/dist-packages/html5lib/_trie/_base.py does have the line from collections import Mapping.
But this issue might also exist with the Python MediaWiki client library, mwclient, that csv2wiki depends on -- /usr/local/lib/python3.7/dist-packages/mwclient/client.py contains this line: from collections import OrderedDict. The mwclient upstream is here, by the way, and as of right now still has that same import.
I'm still puzzled that the html5lib in the core Python 3.7 distribution would be using the obsolete import, but I guess as long as they fix it in 3.8 it doesn't really matter.
There may at least be a reprieve while this gets fixed. Python 3.8.0b1 says,
${env}/site-packages/jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
from collections import MutableMapping
/home/ubuntu/.local/lib/python3.7/site-packages/mwclient/client.py:377: DeprecationWarning: Specifying host as a tuple is deprecated as of mwclient 0.10.0. Please use the new scheme argument instead.
DeprecationWarning
@frankduncan, what version of Python were you trying with?
I'm using Python 3.7.4; I assume that's also the version of html5lib, since it's part of core Python. I'm not seeing the DeprecationWarning you're seeing above. But did you mean to ask about mwclient, rather than html5lib? I'm running mwclient 0.9.3, which I found out like this:
$ python3
Python 3.7.4 (default, Jul 11 2019, 10:43:21)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mwclient
>>> print(mwclient.__file__)
/usr/local/lib/python3.7/dist-packages/mwclient/__init__.py
>>>
...and then I opened up /usr/local/lib/python3.7/dist-packages/mwclient/__init__.py, which had various clues indicating that I should look in /usr/local/lib/python3.7/dist-packages/mwclient/client.py, so I did and that's where I found the __ver__ value.
Activity
[-]Run-time warning coming from html5lib dependency.[/-][+]Run-time warning about import from 'collections'.[/+]kfogel commentedon Jul 3, 2019
Ah, okay, this is probably about
collectionsvscollections.abc(where "abc" is "Abstract Base Class"). See https://stackoverflow.com/questions/53978542/how-to-use-collections-abc-from-both-python-3-8-and-python-2-7 and https://docs.python.org/3/library/collections.abc.html for more information.I'm still puzzled that the
html5libin the core Python 3.7 distribution would be using the obsolete import, but I guess as long as they fix it in 3.8 it doesn't really matter.rillian commentedon Jul 4, 2019
There may at least be a reprieve while this gets fixed. Python 3.8.0b1 says,
frankduncan commentedon Aug 20, 2019
I'm not seeing this, but I am seeing:
What version of html5lib do you have?
kfogel commentedon Aug 20, 2019
@frankduncan, what version of Python were you trying with?
I'm using Python 3.7.4; I assume that's also the version of html5lib, since it's part of core Python. I'm not seeing the DeprecationWarning you're seeing above. But did you mean to ask about mwclient, rather than html5lib? I'm running mwclient 0.9.3, which I found out like this:
...and then I opened up
/usr/local/lib/python3.7/dist-packages/mwclient/__init__.py, which had various clues indicating that I should look in/usr/local/lib/python3.7/dist-packages/mwclient/client.py, so I did and that's where I found the__ver__value.frankduncan commentedon Aug 20, 2019
I'm on mwclient 0.10.0, so maybe you just need to run pip update?