From: Kevin A. <ka...@us...> - 2004-09-11 17:18:53
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22004 Modified Files: util.py Log Message: changed readAndEvalFile to use splitlines Index: util.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/util.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** util.py 24 Aug 2004 20:16:46 -0000 1.32 --- util.py 11 Sep 2004 17:18:44 -0000 1.33 *************** *** 37,41 **** def readAndEvalFile(filename): f = open(filename) ! txt = f.read().replace('\r\n','\n') f.close() return eval(txt, globals()) --- 37,47 ---- def readAndEvalFile(filename): f = open(filename) ! # KEA 2004-09-11 ! # this should be a cleaner way of changing line endings ! # that works for the Mac (\r) as well as Windows (\r\n) line endings ! # but just in case this breaks something I'll leave the ! # old way commented out ! #txt = f.read().replace('\r\n','\n') ! txt = '\n'.join(f.readlines()) f.close() return eval(txt, globals()) |