File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545from types import DictType
4646import marshal
4747
48+
49+
4850class Switchboard :
4951 def __init__ (self , initfile ):
5052 self .__initfile = initfile
@@ -63,11 +65,10 @@ def __init__(self, initfile):
6365 fp = open (initfile )
6466 self .__optiondb = marshal .load (fp )
6567 if type (self .__optiondb ) <> DictType :
66- sys .stderr .write (
67- 'Problem reading options from file: %s\n ' %
68- initfile )
68+ print >> sys .stderr , \
69+ 'Problem reading options from file:' , initfile
6970 self .__optiondb = {}
70- except (IOError , EOFError ):
71+ except (IOError , EOFError , ValueError ):
7172 pass
7273 finally :
7374 if fp :
@@ -118,8 +119,8 @@ def save_views(self):
118119 try :
119120 fp = open (self .__initfile , 'w' )
120121 except IOError :
121- sys .stderr . write ( 'Cannot write options to file: %s \n ' %
122- self .__initfile )
122+ print >> sys .stderr , 'Cannot write options to file:' , \
123+ self .__initfile
123124 else :
124125 marshal .dump (self .__optiondb , fp )
125126 finally :
You can’t perform that action at this time.
0 commit comments