Why am I getting the error “cannot import name Scanner” when I try to use the mwclient module for Python?

StackOverflow https://stackoverflow.com/questions/2307805

Question

I'm using Python 2.5.2 (because mwclient still only works for 2.x). I've copied the mwclient folder into the /usr/lib/python2.5/site-packages/mwclient folder, and when I run a program that imports mwclient I get this:

  Traceback (most recent call last):
  File "get_wiki.py", line 2, in <module>
    import mwclient
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 32, in <module>

  File "/usr/lib/python2.5/site-packages/mwclient/client.py", line 8, in <module>
    import simplejson
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 95, in <module>

  File "/home/troy/eo_project/code/3rd_party/mwclient/simplejson/decoder.py", line 6, in <module>
ImportError: cannot import name Scanner

Scanner seens to exist in the file decoder.py, so I can't figure out what could be wrong.

I'm not set on using mwclient, but I want something that will parse out the mediawiki and HTMl tags whenever possible. I'm looking for plain text to train my language detection program.

Was it helpful?

Solution

Remove the simplejson subdirectory in mwclient if you already have simplejson installed. Or download the latest version from SVN; it has been fixed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top