Re: A Trivial Python Error
Rich Shepard <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 27 Nov 2006, Adrian Klaver wrote:
> Try-
> print 'dbFileName = 'config.projname+ config.dbFileName
> My guess it is an order of execution problem. projname starts out as ' ' and
> that is what you are getting- ' '+'db'=' .db' You need to track down when a
> value is assigned to projname and call dbFileName after that.
Adrian,
The value is assigned to config.projname in functions.newFile(). First the
pwd and filename are assigned by the user. Nothing is done to dbFileName
until immediately after that. The functions.newFile() is:
def newFile(self):
""" Create a new project database file and open it."""
wd = wx.DirDialog(None, "Choose a default directory:", defaultPath=".",
style=wx.DD_DEFAULT_STYLE|wx.DD_NEW_DIR_BUTTON)
if wd.ShowModal() == wx.ID_OK:
config.dirname = wd.GetPath()
wd.Destroy()
ted = wx.TextEntryDialog(self, "Enter the project name", "New Project Name", "",
style=wx.RAISED_BORDER|wx.OK|wx.CANCEL)
if ted.ShowModal() == wx.ID_OK:
config.projname = ted.GetValue()
config.dbFileName = ted.GetValue() + '.db'
ted.Destroy()
Originally, the next-to-last line wasn't there, and config.py did the
assignment of projname + '.db'.
Rich
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863