Make sure you've added your project to your sys.path correctly.  This should
allow update_config to find your config files properly.

Kevin Horn

On 5/28/07, SamDonaldson <[EMAIL PROTECTED]> wrote:
>
>
> I did some more debugging and found that my sys.modules dict does not
> contain the package name as a key in the dict in the case when I run
> the batch independently.  If I run 'tg-admin shell', I see that the
> package name exists as a key in the sys.modules dictionary.
>
> Any thoughts?
>
> thanks.
>
> On May 28, 2:05 am, SamDonaldson <[EMAIL PROTECTED]> wrote:
> > Yes, I tried this.  I still get an error on the update_config line
> > because it is not recognizing my package name.  I'm getting a module
> > not found error.  When I look at the PKG-INFO file, I see the package
> > name and that's the name I'm using:
> >
> > turbogears.update_config(configfile="dev.cfg",
> > modulename="blah.config")
> >
> > When I run this in the 'tg-admin shell', it works.  Any help would be
> > appreciated with this.
> >
> > thanks.
> >
> > On May 26, 7:33 pm, "Kevin Horn" <[EMAIL PROTECTED]> wrote:
> >
> > > follow the instructions in Jason S's post...this should allow you to
> do what
> > > you want
> >
> > > 1) add your project to your sys.path:
> > >     import sys
> > >     sys.path.append("/path/to/your/tubogears/thing")
> > > 2) pull your config into your job script, like so:
> > >     import turbogears
> > >     turbogears.update_config(configfile="dev.cfg",
> > > modulename="project_name.config")
> >
> > > then your script should run fine.
> >
> > > Kevin Horn
> >
> > > On 5/25/07, SamDonaldson <[EMAIL PROTECTED]> wrote:
> >
> > > > I don't want to use the in-built scheduler.  I want to do something
> > > > like this:
> > > > job.py:
> >
> > > > # import <what????>
> >
> > > > class Job(object):
> > > >   def __init__(self):
> > > >     <some work here>
> >
> > > >   def start(self):
> > > >     <connect to database using sqlalchemy>
> > > >     <use some of the ORM classes defined in model.py to do some sql
> > > > queries>
> > > >     <access some symbols in some other files located in different
> > > > directories in my turbogears dir tree>
> >
> > > > __name__ = 'main':
> > > >   j = Job()
> > > >   j.start()
> >
> > > > ------
> > > > run the jobs as follows from command-line:  python job.py
> >
> > > > When I run this from command-line, I can't seem to import model.py
> > > > etc.. as it can't find it in the path.  Also, how do i make a db
> > > > connection.  In the application, I do this using sqlalchemy and the
> > > > config is setup to do so with the uri.  How do I do that here?
> >
> > > > Thanks,
> >
> > > > sam.
> >
> > > > On May 24, 6:00 am, Joost Moesker <[EMAIL PROTECTED]> wrote:
> > > > > I'm not exactly sure what you mean by running a 'independent batch
> job
> > > > > in turbogrears in
> > > > > a separate directory'. TurboGears however has a 'scheduler' which
> can
> > > > > be used to execute batchjobs in a separate thread or childprocess
> > > > > (http://docs.turbogears.org/1.0/Scheduler).
> >
> > > > > On May 24, 8:41 am, SamDonaldson <[EMAIL PROTECTED]> wrote:>
> Hello,
> > > > I'm trying to start an independent batch job in turbogrears in
> > > > > > a separate directory but I got a module not found error.  Do I
> need to
> > > > > > do some extra turbogear initialization or some extra
> imports?  I'm
> > > > > > running the job as such:  python job.py so I"m assuming it needs
> to
> > > > > > connect o turbogear or include some libraries somehow?
> >
> > > > > > Thanks,
> >
> > > > > > Sam.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to