]> granicus.if.org Git - python/commitdiff
Error message goes to stderr
authorBarry Warsaw <barry@python.org>
Thu, 22 Oct 1998 18:48:01 +0000 (18:48 +0000)
committerBarry Warsaw <barry@python.org>
Thu, 22 Oct 1998 18:48:01 +0000 (18:48 +0000)
canceled() takes an optional flag so that the canceled flag can be
cleared.

Tools/pynche/Switchboard.py

index d8fd14c9925a5d30a4a213d6f7e8947c07af2f88..3b06f1118de063699f76e98c99d1dd00804c0ef5 100644 (file)
@@ -12,6 +12,7 @@ conform to the following interface:
       since this would cause it to get updated twice.
 """
 
+import sys
 from types import DictType
 import marshal
 
@@ -33,7 +34,9 @@ class Switchboard:
                     fp = open(initfile)
                     self.__optiondb = marshal.load(fp)
                     if type(self.__optiondb) <> DictType:
-                        print 'Problem reading options from file:', initfile
+                        sys.stderr.write(
+                            'Problem reading options from file: %s\n' %
+                            initfile)
                         self.__optiondb = {}
                 except (IOError, EOFError):
                     pass
@@ -76,7 +79,8 @@ class Switchboard:
             try:
                 fp = open(self.__initfile, 'w')
             except IOError:
-                print 'Cannot write options to file:', file
+                sys.stderr.write('Cannot write options to file: %s\n' %
+                                 self.__initfile)
             else:
                 marshal.dump(self.__optiondb, fp)
         finally:
@@ -88,8 +92,8 @@ class Switchboard:
             if hasattr(v, 'withdraw'):
                 v.withdraw()
 
-    def canceled(self):
-        self.__canceled = 1
+    def canceled(self, flag=1):
+        self.__canceled = flag
 
     def canceled_p(self):
         return self.__canceled