"ImportError: No module named cElementTree"

Bug #225761 reported by Laurens V.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snipper
New
Undecided
Unassigned

Bug Description

After installing the plugin through the steps in de use.wiki file, I (eventually) got this error in Vim at startup:

"ImportError: No module named cElementTree"

The traceback went all the way to ~/bin/snipper/src/snipper.py, line 22:

"import cElementTree as ElementTree"

My default Python installation is v2.5.1. After searching for a solution, I found some useful information in a mailinglist (http://<email address hidden>/msg26945.html); apparently, at some point elementtree was integrated in the standard Python library under the new xml.etree namespace, so a possible solution would be changing the import statement to the following:

"import xml.etree.cElementTree as ElementTree"

This worked like a charm for me. I removed the python-celementtree (because I installed it while finding a solution, and it should not be necessary when using Python 2.5 according to the documentation) and everything was still working like it should.

I presume, but don't know for sure, that this 'fix' could break things when using Python 2.4 (depends on when elementtree was integrated in the standard Python library). I just wanted to let the developers know that I experienced this problem while running the plugin on a fairly 'standard' setup (a fairly standard Ubuntu Linux running Python 2.5.1 as the default installation), and because of the information I found on the mailinglist.

PS: I just got to testing this plugin for the first time, but already have I got this feeling that I'm loving it. Thanks a lot for initiating and maintaining this project!!

Revision history for this message
Roy (roywes) wrote :

I can confirm this bug. My python version is python 2.6.5

The error raised was

""ImportError: No module named cElementTree"

Changing the line

"import cElementTree as ElementTree"

to

"import xml.etree.cElementTree as ElementTree"

solved the problem for me.

Roy

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.