http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8977
Revision: 8977 Author: valhallasw Date: 2011-02-17 20:27:53 +0000 (Thu, 17 Feb 2011) Log Message: ----------- Only import pkg_resources when an import fails. Fixes PYWP-14.
Modified Paths: -------------- branches/rewrite/pywikibot/comms/threadedhttp.py
Modified: branches/rewrite/pywikibot/comms/threadedhttp.py =================================================================== --- branches/rewrite/pywikibot/comms/threadedhttp.py 2011-02-17 00:54:08 UTC (rev 8976) +++ branches/rewrite/pywikibot/comms/threadedhttp.py 2011-02-17 20:27:53 UTC (rev 8977) @@ -38,16 +38,16 @@
# easy_install safeguarded dependencies try: - import pkg_resources -except ImportError: - pywikibot.error( - u"Error: You need the python module setuptools to use this module") - sys.exit(1) -try: import httplib2 except ImportError: - pkg_resources.require("httplib2") - + try: + import pkg_resources + pkg_resources.require("httplib2") + except ImportError: + pywikibot.error( + u"Error: You need the python module setuptools to use this module") + sys.exit(1) + class ConnectionPool(object): """A thread-safe connection pool."""
pywikipedia-svn@lists.wikimedia.org