Author: poeml Date: Thu Jul 30 03:12:55 2009 New Revision: 7721 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=7721 Log: mb new: - print an understandable error message when the geoiplookup_continent couldn't be executed. Modified: trunk/mirrordoctor/mb/geoip.py Modified: trunk/mirrordoctor/mb/geoip.py ============================================================================== --- trunk/mirrordoctor/mb/geoip.py Wed Jul 29 12:44:22 2009 (r7720) +++ trunk/mirrordoctor/mb/geoip.py Thu Jul 30 03:12:55 2009 (r7721) @@ -1,5 +1,7 @@ +import sys import os from subprocess import Popen, PIPE +import errno # try different databases and different locations databases = ['/var/lib/GeoIP/GeoLiteCity.dat.updated', @@ -24,7 +26,12 @@ def lookup_region_code(addr): - out = Popen(['geoiplookup_continent', '-f', database, addr], stdout=PIPE).communicate()[0] + try: + out = Popen(['geoiplookup_continent', '-f', database, addr], stdout=PIPE).communicate()[0] + except OSError, e: + if e.errno == errno.ENOENT: + sys.exit('Error: The geoiplookup_continent binary could not be found.\n' + 'Make sure to install the geoiplookup_continent into a directory contained in $PATH.') return out.strip().lower() _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Thu Jul 30 2009 - 01:12:57 GMT
This archive was generated by hypermail 2.2.0 : Thu Jul 30 2009 - 01:45:07 GMT