On 2007-05-28 16:17:39 -0700, Mike Schinkel wrote:
> 1.) How do I write a simple script to add default data into the
> database? Here's what I'm trying but I keep getting an error saying
> 'Make' is not defined on the last line (if any of this is braindead,
> please remember I'm a newbie in this environment):
>
> imcdb= 'C:\Users\mikes\Desktop\Python\imcdb'
> imcdb_model= imcdb + '\imcdb'
> from sqlobject import *
> import sys, os
> if imcdb_model not in sys.path:
> sys.path.insert(0,imcdb_model)
> import model
> sqlhub.processConnection = connectionForURI('sqlite:///' + imcdb +
> '\devdata.sqllite')
> m= Make() # ERROR HEREWithout looking too closely at the rest, the error is because you've imported the module, but haven't imported Make or the other classes from the model. So you need to either do: from model import Make,Model,Year,ModelYear or you should refer to the class by a fully qualified name: m = model.Make() -- anders pearson : http://www.columbia.edu/~anders/ C C N M T L : http://www.ccnmtl.columbia.edu/ weblog : http://thraxil.org/
pgpnekus5O9kV.pgp
Description: PGP signature

