I ended up creating a virtualenv with the needed libraries within the
modules folder and using the virtualenv python binary to execute the
script within the web2py environment. I feel it's a bit hackish, but
I'll clean it up in the future.

What I do find interesting is that the script is actually executing in
the models folder for things like import lookups and for opening
files. The db (the DAL connection to the database) is only available
as a global in the main() function of my script, I have to explicitly
pass it around otherwise.

Is this the way it works (both executing within the models folder, and
the scope of the globals)?

On Nov 20, 3:17 pm, Dave <oeyonl...@gmail.com> wrote:
> I have a script that uses gevent which monkey patches the standard
> library to use green threads (cooperative coroutines). I'd like this
> to run as a background task using techniques described in "homemade
> task queues" or by using web2py's scheduler. Fundamentally my script
> only needs access to the DAL to manage jobs and perform manual file
> uploads (http://web2py.com/book/default/chapter/06#Manual-Uploads). Is
> there a good way to do this without having the monkey patched standard
> library (socket module, sll module, etc.) from impacting web2py?
>
> Thanks,
> Dave

Reply via email to