From: Alex T. <al...@tw...> - 2005-05-13 00:30:16
|
Apologies if this is a dumb question, but I'm not sure how best to handle this error condition. I discovered that if you start a Pythoncard script when the main script's resource file is missing, you get an error condition; the code in model.py/internationalResourceName() assumes that there will be at least one matching resource file.When there isn't, it tried to use an un-initialized variable .... clearly not the right thing to do. It's easy enough to detect the situation - but what should we then do ? See below for the diff of my current version showing the problem ..... > C:\python\PythonCard>cvs > -d:ext:ale...@cv...:/cvsroot/pythoncard diff > cvs -d:ext:ale...@cv...:/cvsroot/pythoncard diff > ? tools/standaloneBuilder/customDialogs.pyc > ? tools/standaloneBuilder/outputWindow.pyc > ? tools/standaloneBuilder/pmbuild.bat > ? tools/standaloneBuilder/pmbuild.out > ? tools/standaloneBuilder/standaloneBuilder.ini > cvs diff: Diffing . > Index: model.py > =================================================================== > RCS file: /cvsroot/pythoncard/PythonCard/model.py,v > retrieving revision 1.191 > diff -c -r1.191 model.py > *** model.py 30 Mar 2005 18:07:39 -0000 1.191 > --- model.py 13 May 2005 00:21:35 -0000 > *************** > *** 171,180 **** > --- 171,183 ---- > filenames.insert(0, base + '.' + platform + '.' + > language + '_' + country + postfix) > > log.debug(filenames) > + filename = None > for f in filenames: > if os.path.exists(f): > filename = f > break > + if not filename: > + print "no resource file for", base > return filename > > -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 10/05/2005 |