简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM