Index: /pykota/trunk/pykota/dumper.py
===================================================================
--- /pykota/trunk/pykota/dumper.py (revision 2342)
+++ /pykota/trunk/pykota/dumper.py (revision 2512)
@@ -39,5 +39,5 @@
 
 from pykota import version
-from pykota.tool import PyKotaTool, PyKotaToolError, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, N_
 
 class DumPyKota(PyKotaTool) :        
@@ -72,5 +72,5 @@
         """Print Quota Data Dumper."""
         if restricted and not self.config.isAdmin :
-            raise PyKotaToolError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
+            raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
             
         extractonly = {}
@@ -82,5 +82,5 @@
                         raise ValueError                
                 except ValueError :    
-                    raise PyKotaToolError, _("Invalid filter value [%s], see help.") % filterexp
+                    raise PyKotaCommandLineError, _("Invalid filter value [%s], see help.") % filterexp
                 else :    
                     extractonly.update({ filterkey : filtervalue })
@@ -88,10 +88,10 @@
         datatype = options["data"]
         if datatype not in self.validdatatypes.keys() :
-            raise PyKotaToolError, _("Invalid modifier [%s] for --data command line option, see help.") % datatype
+            raise PyKotaCommandLineError, _("Invalid modifier [%s] for --data command line option, see help.") % datatype
                     
         format = options["format"]
         if (format not in self.validformats.keys()) \
               or ((format == "cups") and ((datatype != "history") or options["sum"])) :
-            raise PyKotaToolError, _("Invalid modifier [%s] for --format command line option, see help.") % format
+            raise PyKotaCommandLineError, _("Invalid modifier [%s] for --format command line option, see help.") % format
             
         if (format == "xml") and not hasJAXML :
@@ -99,5 +99,5 @@
             
         if options["sum"] and datatype not in ("payments", "history") : 
-            raise PyKotaToolError, _("Invalid data type [%s] for --sum command line option, see help.") % datatype
+            raise PyKotaCommandLineError, _("Invalid data type [%s] for --sum command line option, see help.") % datatype
             
         entries = getattr(self.storage, "extract%s" % datatype.title())(extractonly)
Index: /pykota/trunk/pykota/tool.py
===================================================================
--- /pykota/trunk/pykota/tool.py (revision 2511)
+++ /pykota/trunk/pykota/tool.py (revision 2512)
@@ -53,5 +53,5 @@
 
 class PyKotaToolError(Exception):
-    """An exception for PyKota config related stuff."""
+    """An exception for PyKota related stuff."""
     def __init__(self, message = ""):
         self.message = message
@@ -60,4 +60,8 @@
         return self.message
     __str__ = __repr__
+    
+class PyKotaCommandLineError(PyKotaToolError) :    
+    """An exception for Pykota command line tools."""
+    pass
     
 def crashed(message="Bug in PyKota") :    
Index: /pykota/trunk/bin/edpykota
===================================================================
--- /pykota/trunk/bin/edpykota (revision 2472)
+++ /pykota/trunk/bin/edpykota (revision 2512)
@@ -29,5 +29,5 @@
 import pwd
 import grp
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 from pykota.config import PyKotaConfigError
 from pykota.storage import PyKotaStorageError
@@ -246,5 +246,5 @@
         """Edit user or group quotas."""
         if not self.config.isAdmin :
-            raise PyKotaToolError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
+            raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
         
         suffix = (options["groups"] and "Group") or "User"        
@@ -261,9 +261,9 @@
             if limitby not in ('quota', 'balance', 'noquota', \
                                         'noprint', 'nochange') :
-                raise PyKotaToolError, _("Invalid limitby value %s") % options["limitby"]
+                raise PyKotaCommandLineError, _("Invalid limitby value %s") % options["limitby"]
             if limitby in ('noquota', 'nochange') :    
                 options["noquota"] = 1
             if (limitby in ('nochange', 'noprint')) and options["groups"] :    
-                raise PyKotaToolError, _("Invalid limitby value %s") % options["limitby"]
+                raise PyKotaCommandLineError, _("Invalid limitby value %s") % options["limitby"]
 
         used = options["used"]
@@ -273,5 +273,5 @@
                 int(used)
             except ValueError :
-                raise PyKotaToolError, _("Invalid used value %s.") % used
+                raise PyKotaCommandLineError, _("Invalid used value %s.") % used
                 
         increase = options["increase"]
@@ -280,5 +280,5 @@
                 increase = int(increase.strip())
             except ValueError :
-                raise PyKotaToolError, _("Invalid increase value %s.") % increase
+                raise PyKotaCommandLineError, _("Invalid increase value %s.") % increase
 
         if not options["noquota"] :
@@ -289,5 +289,5 @@
                         raise ValueError
                 except ValueError :    
-                    raise PyKotaToolError, _("Invalid softlimit value %s.") % options["softlimit"]
+                    raise PyKotaCommandLineError, _("Invalid softlimit value %s.") % options["softlimit"]
             if options["hardlimit"] :
                 try :
@@ -296,5 +296,5 @@
                         raise ValueError
                 except ValueError :    
-                    raise PyKotaToolError, _("Invalid hardlimit value %s.") % options["hardlimit"]
+                    raise PyKotaCommandLineError, _("Invalid hardlimit value %s.") % options["hardlimit"]
             if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) :        
                 # error, exchange them
@@ -307,5 +307,5 @@
                 overcharge = float(overcharge.strip())
             except (ValueError, AttributeError) :    
-                raise PyKotaToolError, _("Invalid overcharge value %s") % options["overcharge"]
+                raise PyKotaCommandLineError, _("Invalid overcharge value %s") % options["overcharge"]
                 
         balance = options["balance"]
@@ -315,5 +315,5 @@
                 balancevalue = float(balance)
             except ValueError :    
-                raise PyKotaToolError, _("Invalid balance value %s") % options["balance"]
+                raise PyKotaCommandLineError, _("Invalid balance value %s") % options["balance"]
             
         if options["charge"] :
@@ -321,5 +321,5 @@
                 charges = [float(part) for part in options["charge"].split(',', 1)]
             except ValueError :    
-                raise PyKotaToolError, _("Invalid charge amount value %s") % options["charge"]
+                raise PyKotaCommandLineError, _("Invalid charge amount value %s") % options["charge"]
             else :    
                 if len(charges) > 2 :
@@ -346,10 +346,10 @@
                         raise PyKotaToolError, _("Impossible to add printer %s") % pname
                 else :    
-                    raise PyKotaToolError, _("Invalid printer name %s") % pname
+                    raise PyKotaCommandLineError, _("Invalid printer name %s") % pname
             else :
-                raise PyKotaToolError, _("There's no printer matching %s") % pname
+                raise PyKotaCommandLineError, _("There's no printer matching %s") % pname
         if not names :    
             if options["delete"] :    
-                raise PyKotaToolError, _("You have to pass user or group names on the command line")
+                raise PyKotaCommandLineError, _("You have to pass user or group names on the command line")
             else :
                 names = getattr(self.storage, "getAll%ssNames" % suffix)() # all users or groups
@@ -362,5 +362,5 @@
             protoentry = getattr(self.storage, "get%s" % suffix)(options["prototype"])
             if not protoentry.Exists :
-                raise PyKotaToolError, _("Prototype object %s not found in Quota Storage.") % protoentry.Name
+                raise PyKotaCommandLineError, _("Prototype object %s not found in Quota Storage.") % protoentry.Name
             else :    
                 limitby = protoentry.LimitBy
@@ -598,19 +598,21 @@
             editor.display_version_and_quit()
         elif options["users"] and options["groups"] :    
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         elif (options["add"] or options["prototype"]) and options["delete"] :    
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         elif (options["reset"] or options["hardreset"] or options["limitby"] or options["used"] or options["balance"] or options["overcharge"] or options["softlimit"] or options["hardlimit"]) and options["prototype"] :
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         elif options["noquota"] and (options["prototype"] or options["hardlimit"] or options["softlimit"]) :
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         elif options["groups"] and (options["balance"] or options["ingroups"] or options["used"] or options["overcharge"]) :
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         elif options["comment"] and not options["balance"] :    
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         else :
             retcode = editor.main(args, options)
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :     
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/pykotme
===================================================================
--- /pykota/trunk/bin/pykotme (revision 2352)
+++ /pykota/trunk/bin/pykotme (revision 2512)
@@ -29,5 +29,5 @@
 import pwd
 
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 
 try :
@@ -96,5 +96,5 @@
         printers = self.storage.getMatchingPrinters(options["printer"])
         if not printers :
-            raise PyKotaToolError, _("There's no printer matching %s") % options["printer"]
+            raise PyKotaCommandLineError, _("There's no printer matching %s") % options["printer"]
             
         username = pwd.getpwuid(os.getuid())[0]
@@ -140,4 +140,6 @@
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/pkbcodes
===================================================================
--- /pykota/trunk/bin/pkbcodes (revision 2344)
+++ /pykota/trunk/bin/pkbcodes (revision 2512)
@@ -29,5 +29,5 @@
 import pwd
 
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 
 __doc__ = N_("""pkbcodes v%(__version__)s (c) %(__years__)s %(__author__)s
@@ -87,5 +87,5 @@
         """Manage billing codes."""
         if (not self.config.isAdmin) and (not options["list"]) :
-            raise PyKotaToolError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
+            raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
             
         if (options["list"] or options["reset"]) and not names :
@@ -111,5 +111,5 @@
             billingcodes = self.storage.getMatchingBillingCodes(",".join(names))
             if not billingcodes :
-                raise PyKotaToolError, _("There's no billingcode matching %s") % " ".join(names)
+                raise PyKotaCommandLineError, _("There's no billingcode matching %s") % " ".join(names)
                     
         for billingcode in billingcodes :        
@@ -160,11 +160,13 @@
            or (options["skipexisting"] and not options["add"]) \
            or (options["list"] and (options["add"] or options["delete"] or options["reset"] or options["description"])) :
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         elif (not args) and (options["add"] or options["delete"]) :    
-            raise PyKotaToolError, _("You have to pass billing codes on the command line")
+            raise PyKotaCommandLineError, _("You have to pass billing codes on the command line")
         else :
             retcode = manager.main(args, options)
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/pkturnkey
===================================================================
--- /pykota/trunk/bin/pkturnkey (revision 2509)
+++ /pykota/trunk/bin/pkturnkey (revision 2512)
@@ -32,5 +32,5 @@
 import signal
 
-from pykota.tool import Tool, PyKotaToolError, crashed, N_
+from pykota.tool import Tool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 
 __doc__ = N_("""pkturnkey v%(__version__)s (c) %(__years__)s %(__author__)s
@@ -342,5 +342,5 @@
         """Intializes PyKota's database."""
         if not self.config.isAdmin :
-            raise PyKotaToolError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0],\
+            raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0],\
                                    _("You're not allowed to use this command."))
             
@@ -366,5 +366,5 @@
                         uidmin = pwd.getpwnam(options["uidmin"])[2]
                     except KeyError, msg :    
-                        raise PyKotaToolError, _("Unknown username %s : %s") \
+                        raise PyKotaCommandLineError, _("Unknown username %s : %s") \
                                                    % (options["uidmin"], msg)
                         
@@ -378,5 +378,5 @@
                         uidmax = pwd.getpwnam(options["uidmax"])[2]
                     except KeyError, msg :    
-                        raise PyKotaToolError, _("Unknown username %s : %s") \
+                        raise PyKotaCommandLineError, _("Unknown username %s : %s") \
                                                    % (options["uidmax"], msg)
             
@@ -398,5 +398,5 @@
                         gidmin = grp.getgrnam(options["gidmin"])[2]
                     except KeyError, msg :    
-                        raise PyKotaToolError, _("Unknown groupname %s : %s") \
+                        raise PyKotaCommandLineError, _("Unknown groupname %s : %s") \
                                                    % (options["gidmin"], msg)
                         
@@ -410,5 +410,5 @@
                         gidmax = grp.getgrnam(options["gidmax"])[2]
                     except KeyError, msg :    
-                        raise PyKotaToolError, _("Unknown groupname %s : %s") \
+                        raise PyKotaCommandLineError, _("Unknown groupname %s : %s") \
                                                    % (options["gidmax"], msg)
             
@@ -492,4 +492,6 @@
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/repykota
===================================================================
--- /pykota/trunk/bin/repykota (revision 2452)
+++ /pykota/trunk/bin/repykota (revision 2512)
@@ -31,8 +31,5 @@
 from mx import DateTime
 
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
-from pykota.config import PyKotaConfigError
-from pykota.storage import PyKotaStorageError
-from pykota.reporter import PyKotaReporterError
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 from pykota import reporter
 
@@ -110,5 +107,5 @@
             # reports only the current user
             if options["ingroups"] :
-                raise PyKotaToolError, _("Option --ingroups is reserved to PyKota Administrators.")
+                raise PyKotaCommandLineError, _("Option --ingroups is reserved to PyKota Administrators.")
                 
             username = pwd.getpwuid(os.geteuid())[0]
@@ -124,5 +121,5 @@
         printers = self.storage.getMatchingPrinters(options["printer"])
         if not printers :
-            raise PyKotaToolError, _("There's no printer matching %s") % options["printer"]
+            raise PyKotaCommandLineError, _("There's no printer matching %s") % options["printer"]
             
         self.reportingtool = reporter.openReporter(self, "text", printers, ugnames, (options["groups"] and 1) or 0)    
@@ -157,10 +154,12 @@
         elif options["version"] :
             reportTool.display_version_and_quit()
-        elif options["users"] and options["groups"] :    
-            raise PyKotaToolError, _("incompatible options, see help.")
+        elif (options["users"] or options["ingroups"]) and options["groups"] :
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         else :
             retcode = reportTool.main(args, options)
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/warnpykota
===================================================================
--- /pykota/trunk/bin/warnpykota (revision 2344)
+++ /pykota/trunk/bin/warnpykota (revision 2512)
@@ -29,5 +29,5 @@
 import pwd
 
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 from pykota.config import PyKotaConfigError
 from pykota.storage import PyKotaStorageError
@@ -108,5 +108,5 @@
         printers = self.storage.getMatchingPrinters(options["printer"])
         if not printers :
-            raise PyKotaToolError, _("There's no printer matching %s") % options["printer"]
+            raise PyKotaCommandLineError, _("There's no printer matching %s") % options["printer"]
         alreadydone = {}
         for printer in printers :
@@ -155,9 +155,11 @@
             sender.display_version_and_quit()
         elif options["users"] and options["groups"] :    
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         else :
             retcode = sender.main(args, options)
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/pkbanner
===================================================================
--- /pykota/trunk/bin/pkbanner (revision 2344)
+++ /pykota/trunk/bin/pkbanner (revision 2512)
@@ -47,5 +47,5 @@
     hasPIL = 1
     
-from pykota.tool import Tool, PyKotaToolError, crashed, N_
+from pykota.tool import Tool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 
 __doc__ = N_("""pkbanner v%(__version__)s (c) %(__years__)s %(__author__)s
@@ -312,4 +312,6 @@
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/autopykota
===================================================================
--- /pykota/trunk/bin/autopykota (revision 2447)
+++ /pykota/trunk/bin/autopykota (revision 2512)
@@ -28,5 +28,5 @@
 import os
 
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 
 __doc__ = N_("""autopykota v%(__version__)s (c) %(__years__)s %(__author__)s
@@ -115,9 +115,11 @@
             automat.display_version_and_quit()
         elif args :    
-            raise PyKotaToolError, "autopykota doesn't accept non option arguments !"
+            raise PyKotaCommandLineError, "autopykota doesn't accept non option arguments !"
         else :
             retcode = automat.main(args, options)
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/pkprinters
===================================================================
--- /pykota/trunk/bin/pkprinters (revision 2465)
+++ /pykota/trunk/bin/pkprinters (revision 2512)
@@ -29,5 +29,5 @@
 import pwd
 
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 
 __doc__ = N_("""pkprinters v%(__version__)s (c) %(__years__)s %(__author__)s
@@ -127,5 +127,5 @@
         """Manage printers."""
         if (not self.config.isAdmin) and (not options["list"]) :
-            raise PyKotaToolError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
+            raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
             
         if options["list"] and not names :
@@ -135,5 +135,5 @@
             printersgroups = self.storage.getMatchingPrinters(options["groups"])
             if not printersgroups :
-                raise PyKotaToolError, _("There's no printer matching %s") % " ".join(options["groups"].split(','))
+                raise PyKotaCommandLineError, _("There's no printer matching %s") % " ".join(options["groups"].split(','))
             
         if options["charge"] :
@@ -141,5 +141,5 @@
                 charges = [float(part) for part in options["charge"].split(',', 1)]
             except ValueError :    
-                raise PyKotaToolError, _("Invalid charge amount value %s") % options["charge"]
+                raise PyKotaCommandLineError, _("Invalid charge amount value %s") % options["charge"]
             else :    
                 if len(charges) > 2 :
@@ -155,5 +155,5 @@
                     raise ValueError
             except ValueError :    
-                raise PyKotaToolError, _("Invalid maximum job size value %s") % options["maxjobsize"]
+                raise PyKotaCommandLineError, _("Invalid maximum job size value %s") % options["maxjobsize"]
         else :        
             maxjobsize = None
@@ -178,9 +178,9 @@
                             printers.append(printer)
                     else :    
-                        raise PyKotaToolError, _("Invalid printer name %s") % pname
+                        raise PyKotaCommandLineError, _("Invalid printer name %s") % pname
         else :        
             printers = self.storage.getMatchingPrinters(",".join(names))
             if not printers :
-                raise PyKotaToolError, _("There's no printer matching %s") % " ".join(names)
+                raise PyKotaCommandLineError, _("There's no printer matching %s") % " ".join(names)
                     
         for printer in printers :        
@@ -255,13 +255,15 @@
            or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["charge"] or options["remove"] or options["description"])) \
            or (options["passthrough"] and options["nopassthrough"]) :
-            raise PyKotaToolError, _("incompatible options, see help.")
+            raise PyKotaCommandLineError, _("incompatible options, see help.")
         elif options["remove"] and not options["groups"] :    
-            raise PyKotaToolError, _("You have to pass printer groups names on the command line")
+            raise PyKotaCommandLineError, _("You have to pass printer groups names on the command line")
         elif (not args) and (not options["list"]) :    
-            raise PyKotaToolError, _("You have to pass printer names on the command line")
+            raise PyKotaCommandLineError, _("You have to pass printer names on the command line")
         else :
             retcode = manager.main(args, options)
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/pykosd
===================================================================
--- /pykota/trunk/bin/pykosd (revision 2344)
+++ /pykota/trunk/bin/pykosd (revision 2512)
@@ -36,5 +36,5 @@
     sys.exit(-1)
 
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 
 __doc__ = N_("""pykosd v%(__version__)s (c) %(__years__)s %(__author__)s
@@ -83,16 +83,22 @@
         try :    
             duration = int(options["duration"])
-        except :    
-            raise PyKotaToolError, _("Invalid duration option %s") % str(options["duration"])
+            if duration <= 0 :
+                raise ValueError 
+        except :    
+            raise PyKotaCommandLineError, _("Invalid duration option %s") % str(options["duration"])
             
         try :    
             loop = int(options["loop"])
-        except :    
-            raise PyKotaToolError, _("Invalid loop option %s") % str(options["loop"])
+            if loop < 0 :
+                raise ValueError
+        except :    
+            raise PyKotaCommandLineError, _("Invalid loop option %s") % str(options["loop"])
             
         try :    
             sleep = float(options["sleep"])
-        except :    
-            raise PyKotaToolError, _("Invalid sleep option %s") % str(options["sleep"])
+            if sleep <= 0 :
+                raise ValueError
+        except :    
+            raise PyKotaCommandLineError, _("Invalid sleep option %s") % str(options["sleep"])
             
         color = options["color"]    
@@ -100,5 +106,5 @@
             color = "#%s" % color
         if len(color) != 7 :    
-            raise PyKotaToolError, _("Invalid color option %s") % str(color)
+            raise PyKotaCommandLineError, _("Invalid color option %s") % str(color)
         savecolor = color
         
@@ -108,5 +114,5 @@
             user = cmd.storage.getUserFromBackend(uname)        # don't use cache
             if not user.Exists :
-                raise PyKotaToolError, _("User %s doesn't exist in PyKota's database") % uname
+                raise PyKotaCommandLineError, _("User %s doesn't exist in PyKota's database") % uname
             if user.LimitBy == "quota" :    
                 printers = cmd.storage.getMatchingPrinters("*")
@@ -177,4 +183,6 @@
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/pkmail
===================================================================
--- /pykota/trunk/bin/pkmail (revision 2352)
+++ /pykota/trunk/bin/pkmail (revision 2512)
@@ -31,5 +31,5 @@
 import email
 
-from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
     
 __doc__ = N_("""pkmail v%(__version__)s (c) %(__years__)s %(__author__)s
@@ -87,5 +87,5 @@
             (command, arguments) = (cmdargs[0].capitalize(), cmdargs[1:])
         except IndexError :    
-            raise PyKotaToolError, "No command found !"
+            raise PyKotaCommandLineError, "No command found !"
         
         badchars = """/<>&"'#!%*$,;\\"""
@@ -159,4 +159,6 @@
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
Index: /pykota/trunk/bin/dumpykota
===================================================================
--- /pykota/trunk/bin/dumpykota (revision 2344)
+++ /pykota/trunk/bin/dumpykota (revision 2512)
@@ -29,5 +29,5 @@
 
 from pykota import version
-from pykota.tool import PyKotaToolError, crashed, N_
+from pykota.tool import PyKotaToolError, PyKotaCommandLineError, crashed, N_
 from pykota.dumper import DumPyKota
 
@@ -154,9 +154,11 @@
             dumper.display_version_and_quit()
         elif options["data"] is None :    
-            raise PyKotaToolError, _("The -d | --data command line option is mandatory, see help.")
+            raise PyKotaCommandLineError, _("The -d | --data command line option is mandatory, see help.")
         else :
             retcode = dumper.main(args, options)
     except KeyboardInterrupt :        
         sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+    except PyKotaCommandLineError, msg :    
+        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
     except SystemExit :        
         pass
