Simple Python App Server

Diez B. Roggisch deets at nospam.web.de
Fri Aug 18 13:48:37 EDT 2006


tom.purl schrieb:
> I use the pyGTD script to manage my todo lists and such.  From Vim, I
> shell out a call to the gtd.py script, which updates my todo.txt file
> after update one of the related pyGTD files.  Since I make a lot of
> updates to the related pyGTD files, I execute the gtd.py script dozens
> of times a day.
> 
> The problem is that this script can be a little slow.  It usually takes
> at least 5 seconds to run, time that I can't use Vim (and running it in
> the background from Vim isn't a usable option for me).  I tried making
> it run faster by adding the following lines at the top of the __main__
> method:
> 
>     import psyco
>     psyco.full()
> 
> This change, however, didn't shave off any noticeable amount of time.
> 
> I was wondering if there was a way in which I could run the python
> interpreter all of the time so that I wouldn't have to invoke it each
> time that I want to run the gtd.py script.  Is there a way to do this?o


Sure. Just enter a loop. Incidentially, common application server 
frameworks as SimpleXMLRPC or pyro come with a main event loop which 
will of course prevent the interpreter to stop.

Together with the daemonize-recipe from apsn, you have your server.

I suggest you use pyro - that will most probably cause the least fuss.

Diez



More information about the Python-list mailing list