Index: pykota/trunk/bin/edpykota
===================================================================
--- pykota/trunk/bin/edpykota (revision 3288)
+++ pykota/trunk/bin/edpykota (revision 3294)
@@ -23,4 +23,7 @@
 
 import sys
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaCommandLineError
@@ -352,8 +355,8 @@
             retcode = manager.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :     
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pkinvoice
===================================================================
--- pykota/trunk/bin/pkinvoice (revision 3288)
+++ pykota/trunk/bin/pkinvoice (revision 3294)
@@ -43,4 +43,7 @@
 else :    
     hasPIL = True
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaToolError, PyKotaCommandLineError
@@ -403,8 +406,8 @@
             retcode = invoiceGenerator.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :     
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pykotme
===================================================================
--- pykota/trunk/bin/pykotme (revision 3288)
+++ pykota/trunk/bin/pykotme (revision 3294)
@@ -25,4 +25,7 @@
 import os
 import pwd
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaCommandLineError
@@ -156,8 +159,8 @@
             retcode = sender.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pkbcodes
===================================================================
--- pykota/trunk/bin/pkbcodes (revision 3288)
+++ pykota/trunk/bin/pkbcodes (revision 3294)
@@ -25,4 +25,7 @@
 import sys
 import pwd
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaCommandLineError
@@ -199,8 +202,8 @@
             retcode = manager.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pksetup
===================================================================
--- pykota/trunk/bin/pksetup (revision 3290)
+++ pykota/trunk/bin/pksetup (revision 3294)
@@ -408,5 +408,5 @@
         homedirectory = self.addPyKotaUser()
         if homedirectory is None :
-            sys.stderr.write("Installation can't proceed. You MUST create a system user named 'pykota'.\n")
+            logerr("Installation can't proceed. You MUST create a system user named 'pykota'.\n")
         else :    
             self.upgradeSystem()
@@ -465,5 +465,5 @@
             installer = globals()[classname]()
         except KeyError :    
-            sys.stderr.write("There's currently no support for the %s distribution, sorry.\n" % sys.argv[1])
+            logerr("There's currently no support for the %s distribution, sorry.\n" % sys.argv[1])
             retcode = -1
         else :    
@@ -471,5 +471,5 @@
                 retcode = installer.setup()
             except KeyboardInterrupt :             
-                sys.stderr.write("\n\n\nWARNING : Setup was aborted at user's request !\n\n")
+                logerr("\n\n\nWARNING : Setup was aborted at user's request !\n\n")
                 retcode = -1
     sys.exit(retcode)
Index: pykota/trunk/bin/pkturnkey
===================================================================
--- pykota/trunk/bin/pkturnkey (revision 3288)
+++ pykota/trunk/bin/pkturnkey (revision 3294)
@@ -29,4 +29,7 @@
 import signal
 
+import pykota.appinit
+from pykota.utils import *
+
 from pykota.errors import PyKotaToolError, PyKotaCommandLineError
 from pykota.tool import Tool, crashed, N_
@@ -226,5 +229,5 @@
                 from pysnmp.proto.api import alpha
             except ImportError :    
-                sys.stderr.write("pysnmp doesn't seem to be installed. SNMP checks will be ignored !\n")
+                logerr("pysnmp doesn't seem to be installed. SNMP checks will be ignored !\n")
                 return 0
         else :        
@@ -528,8 +531,8 @@
             retcode = manager.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pkusers
===================================================================
--- pykota/trunk/bin/pkusers (revision 3288)
+++ pykota/trunk/bin/pkusers (revision 3294)
@@ -25,4 +25,7 @@
 import pwd
 import grp
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaCommandLineError
@@ -440,8 +443,8 @@
             retcode = manager.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/repykota
===================================================================
--- pykota/trunk/bin/repykota (revision 3288)
+++ pykota/trunk/bin/repykota (revision 3294)
@@ -27,4 +27,7 @@
 
 from mx import DateTime
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaToolError, PyKotaCommandLineError
@@ -157,8 +160,8 @@
             retcode = reportTool.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/warnpykota
===================================================================
--- pykota/trunk/bin/warnpykota (revision 3288)
+++ pykota/trunk/bin/warnpykota (revision 3294)
@@ -25,4 +25,7 @@
 import os
 import pwd
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaCommandLineError
@@ -156,8 +159,8 @@
             retcode = sender.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pkbanner
===================================================================
--- pykota/trunk/bin/pkbanner (revision 3288)
+++ pykota/trunk/bin/pkbanner (revision 3294)
@@ -44,4 +44,7 @@
     hasPIL = True
     
+import pykota.appinit
+from pykota.utils import *
+
 from pykota.errors import PyKotaToolError, PyKotaCommandLineError
 from pykota.tool import Tool, crashed, N_
@@ -325,8 +328,8 @@
             retcode = banner.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/autopykota
===================================================================
--- pykota/trunk/bin/autopykota (revision 3288)
+++ pykota/trunk/bin/autopykota (revision 3294)
@@ -25,4 +25,7 @@
 import sys
 import os
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaToolError, PyKotaCommandLineError
@@ -140,8 +143,8 @@
             retcode = automat.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pkprinters
===================================================================
--- pykota/trunk/bin/pkprinters (revision 3288)
+++ pykota/trunk/bin/pkprinters (revision 3294)
@@ -25,4 +25,7 @@
 import sys
 import pwd
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaCommandLineError
@@ -372,8 +375,8 @@
             retcode = manager.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/cupspykota
===================================================================
--- pykota/trunk/bin/cupspykota (revision 3288)
+++ pykota/trunk/bin/cupspykota (revision 3294)
@@ -43,4 +43,7 @@
 
 from mx import DateTime
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaToolError
@@ -1313,5 +1316,5 @@
         sys.exit(0)                
     elif len(sys.argv) not in (6, 7) :    
-        sys.stderr.write("ERROR: %s job-id user title copies options [file]\n"\
+        logerr("ERROR: %s job-id user title copies options [file]\n"\
                               % sys.argv[0])
         sys.exit(1)
Index: pykota/trunk/bin/pknotify
===================================================================
--- pykota/trunk/bin/pknotify (revision 3288)
+++ pykota/trunk/bin/pknotify (revision 3294)
@@ -34,4 +34,7 @@
 else :    
     hasPAM = True
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaToolError, PyKotaCommandLineError
@@ -354,8 +357,8 @@
             retcode = notifier.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         print "CANCEL"  # Forces the cancellation of the print job if a command line switch is incorrect
         retcode = -2
Index: pykota/trunk/bin/pykosd
===================================================================
--- pykota/trunk/bin/pykosd (revision 3288)
+++ pykota/trunk/bin/pykosd (revision 3294)
@@ -30,6 +30,9 @@
     import pyosd
 except ImportError :    
-    sys.stderr.write("Sorry ! You need both xosd and the Python OSD library (pyosd) for this software to work.\n")
+    logerr("Sorry ! You need both xosd and the Python OSD library (pyosd) for this software to work.\n")
     sys.exit(-1)
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaToolError, PyKotaCommandLineError
@@ -192,8 +195,8 @@
         retcode = 0
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pkmail
===================================================================
--- pykota/trunk/bin/pkmail (revision 3288)
+++ pykota/trunk/bin/pkmail (revision 3294)
@@ -30,4 +30,7 @@
 from email.Header import Header
 import email.Utils
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaCommandLineError
@@ -164,8 +167,8 @@
             retcode = mailparser.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/dumpykota
===================================================================
--- pykota/trunk/bin/dumpykota (revision 3288)
+++ pykota/trunk/bin/dumpykota (revision 3294)
@@ -23,4 +23,7 @@
 
 import sys
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaCommandLineError
@@ -183,8 +186,8 @@
             retcode = dumper.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
Index: pykota/trunk/bin/pkrefund
===================================================================
--- pykota/trunk/bin/pkrefund (revision 3288)
+++ pykota/trunk/bin/pkrefund (revision 3294)
@@ -43,4 +43,7 @@
 else :    
     hasPIL = True
+
+import pykota.appinit
+from pykota.utils import *
 
 from pykota.errors import PyKotaToolError, PyKotaCommandLineError
@@ -440,8 +443,8 @@
             retcode = refundmanager.main(args, options)
     except KeyboardInterrupt :        
-        sys.stderr.write("\nInterrupted with Ctrl+C !\n")
+        logerr("\nInterrupted with Ctrl+C !\n")
         retcode = -3
     except PyKotaCommandLineError, msg :    
-        sys.stderr.write("%s : %s\n" % (sys.argv[0], msg))
+        logerr("%s : %s\n" % (sys.argv[0], msg))
         retcode = -2
     except SystemExit :        
