开发者

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

开发者 https://www.devze.com 2022-12-21 06:54 出处:网络
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 m

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消