ImportError: No module named etree.ElementTree when running Yahoo BOSS for the first time

3.1k views Asked by At

I installed Yahoo BOSS (it's a Python installation that allows you to use their search features). I followed everything perfectly. However, when I run the example to confirm that it works, I get this:

$ python ex3.py
Traceback (most recent call last):
  File "ex3.py", line 16, in ?
    from yos.yql import db
  File "/usr/lib/python2.4/site-packages/yos/yql/db.py", line 44, in ?
    from yos.crawl import rest
  File "/usr/lib/python2.4/site-packages/yos/crawl/rest.py", line 13, in ?
    import xml2dict
  File "/usr/lib/python2.4/site-packages/yos/crawl/xml2dict.py", line 6, in ?
    import xml.etree.ElementTree as ET
ImportError: No module named etree.ElementTree

Is there any way to fix this? I did exactly as stated in the documentation and it was installed on a fresh box.

People have suggested that Python 2.5 should be used, but everything currently uses Python 2.4. What should I do to get this Yahoo BOSS to work?

Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
2

There are 2 answers

3
Jeffrey Hulten On BEST ANSWER

Use Python 2.5 or above: xml.etree.ElementTree was added in 2.5.

http://docs.python.org/library/xml.etree.elementtree.html

1
Jonathan Feinberg On

A google search reveals that you need to install the effbot elementtree Python module.