[Python-checkins] CVS: python/dist/src/Tools/pynche Switchboard.py,2.9,2.10
Barry Warsaw
bwarsaw@users.sourceforge.net
Tue, 10 Jul 2001 14:48:53 -0700
Update of /cvsroot/python/python/dist/src/Tools/pynche
In directory usw-pr-cvs1:/tmp/cvs-serv32127
Modified Files:
Switchboard.py
Log Message:
__init__(), save_views(): Catch ValueError along with IOError and
EOFError so any failures in unmarshalling are just ignored. Use
print>> instead of sys.stderr.write().
Index: Switchboard.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/pynche/Switchboard.py,v
retrieving revision 2.9
retrieving revision 2.10
diff -C2 -r2.9 -r2.10
*** Switchboard.py 1999/04/27 18:53:29 2.9
--- Switchboard.py 2001/07/10 21:48:51 2.10
***************
*** 46,49 ****
--- 46,51 ----
import marshal
+
+
class Switchboard:
def __init__(self, initfile):
***************
*** 64,72 ****
self.__optiondb = marshal.load(fp)
if type(self.__optiondb) <> DictType:
! sys.stderr.write(
! 'Problem reading options from file: %s\n' %
! initfile)
self.__optiondb = {}
! except (IOError, EOFError):
pass
finally:
--- 66,73 ----
self.__optiondb = marshal.load(fp)
if type(self.__optiondb) <> DictType:
! print >> sys.stderr, \
! 'Problem reading options from file:', initfile
self.__optiondb = {}
! except (IOError, EOFError, ValueError):
pass
finally:
***************
*** 119,124 ****
fp = open(self.__initfile, 'w')
except IOError:
! sys.stderr.write('Cannot write options to file: %s\n' %
! self.__initfile)
else:
marshal.dump(self.__optiondb, fp)
--- 120,125 ----
fp = open(self.__initfile, 'w')
except IOError:
! print >> sys.stderr, 'Cannot write options to file:', \
! self.__initfile
else:
marshal.dump(self.__optiondb, fp)