]> granicus.if.org Git - python/commitdiff
usage(): Print msg at end of docstring
authorBarry Warsaw <barry@python.org>
Tue, 6 Oct 1998 15:21:04 +0000 (15:21 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 6 Oct 1998 15:21:04 +0000 (15:21 +0000)
main(): Fixed logic error and reporting when no colordb was found.
Given by GvR.

Tools/pynche/Main.py

index 403f8b1f9fde2367e1967965dda5bf01d5691d72..700d2f986f325af903f8cd9e342e35c80926f49c 100644 (file)
@@ -55,9 +55,9 @@ RGB_TXT = [
 
 \f
 def usage(status, msg=''):
+    print __doc__ % globals()
     if msg:
        print msg
-    print __doc__ % globals()
     sys.exit(status)
 
 
@@ -88,11 +88,12 @@ def main():
     for f in RGB_TXT:
        try:
            colordb = ColorDB.get_colordb(f)
-           break
+            if colordb:
+                break
        except IOError:
            pass
     else:
-       raise IOError('No color database file found')
+        usage(1, 'No color database file found, see the -d option.')
 
     # get triplet for initial color
     try: