Re: A Trivial Python Error
Adrian Klaver <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
On Monday 27 November 2006 12:11 pm, Rich Shepard wrote: > I cannot concatenate a variable holding the file name with the suffix of > '.db' in my application. It _should_ work, but it isn't and I don't see > why. > > The calling module has this method: > > def OnNewMod(self, event): > newName = functions.newFile(self) > self.tcName.SetValue(config.projname) > print 'pwd = '+ config.dirname > print 'project name = '+ config.projname > print 'dbFileName = '+ config.dbFileName > # DBtools().OpenDB(config.dbFileName) > > the functions module's functions do their job and return two of the three > variables defined in config.py. That module contains: > > dirname = ' ' > projname = ' ' > dbFileName = projname + '.db' > > However, when I run the application the three print statements show: > > pwd = /data1/eikos > project name = foobar > dbFileName = .db > > What simple thing have I missed that the value of config.projname is not > being assigned to config.dbFileName? > > Rich 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 Klaver [email protected]