[Distutils] Better error reporting

Jim Fulton jim at zope.com
Mon Feb 12 17:09:11 CET 2007


There are places where setuptools exceptions sometimes lack important  
information.  For example, in  PackageIndex.open_url, there is:

     def open_url(self, url):
         if url.startswith('file:'):
             return local_open(url)
         try:
             return open_with_auth(url)
         except urllib2.HTTPError, v:
             return v
         except urllib2.URLError, v:
             raise DistutilsError("Download error: %s" % v.reason)

Getting a download error without knowing what the error is for is  
rather frustrating. :)

IMO, this should be:

     def open_url(self, url):
         if url.startswith('file:'):
             return local_open(url)
         try:
             return open_with_auth(url)
         except urllib2.HTTPError, v:
             return v
         except urllib2.URLError, v:
             raise DistutilsError("Download error for %r: %s" % (url,  
v.reason))

Phillip, would you like me to go ahead and make minor changes like  
this? Or would you rather make them yourself?

Jim

--
Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org





More information about the Distutils-SIG mailing list