[Pywikipedia-l] SVN: [5402] trunk/pywikipedia/wikipedia.py
nicdumz at svn.wikimedia.org
nicdumz at svn.wikimedia.org
Mon May 19 07:03:34 UTC 2008
Revision: 5402
Author: nicdumz
Date: 2008-05-19 07:03:34 +0000 (Mon, 19 May 2008)
Log Message:
-----------
Trying to use ElementTree when cElementTree is not available.
If not available, dying.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2008-05-18 19:17:39 UTC (rev 5401)
+++ trunk/pywikipedia/wikipedia.py 2008-05-19 07:03:34 UTC (rev 5402)
@@ -4423,10 +4423,21 @@
def mediawiki_message(self, key):
"""Return the MediaWiki message text for key "key" """
try:
- from xml.etree.cElementTree import XML
+ from xml.etree.cElementTree import XML # 2.5
except ImportError:
- from cElementTree import XML
-
+ try:
+ from cElementTree import XML
+ except ImportError:
+ output('Module cElementTree not found, using instead the slower ElementTree')
+ try:
+ from xml.etree.ElementTree import XML # 2.5
+ except ImportError:
+ try:
+ from elementtree.ElementTree import XML
+ except ImportError:
+ output('ERROR: You need to install cElementTree, or ElementTree module to be able to parse mediawiki messages')
+ stopme()
+ sys.exit(1)
# Allmessages is retrieved once for all in a session
if not self._mediawiki_messages:
if verbose:
More information about the Pywikipedia-l
mailing list