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
-~----------~----~----~----~------~----~------~--~---