I am trying to call this module that contains a series of import_csv_file statement like so:
from my model, db_history.py I call up a module to import a series of csv files: initialize=local_import('initialize') initialize.fillup(db) my modules/fillup.py looks like this: import os def fillup(): try: db.question.import_from_csv_file(open(os.path.join(request.folder,'private/db_question.csv'),'r')) except Exception, e: print 'oops: %s' % e #XXX raise e ... Then I get: "NameError: global name 'request' is not defined" What's weird is that those import statements run from the shell. They also work fine if I put them in the model that calls it. But, I'm hoping to database initialization by CSV from a single module file. I'm pretty sure I'm missing something here. Anyone?