How to get progress in python script.
Jean-Michel Pichavant
jeanmichel at sequans.com
Fri Sep 28 13:07:03 EDT 2012
----- Original Message -----
> Hi all,
>
> Please, I need you suggest me a way to get statistics about a
> progress
> of my python script. My python script could take a lot of time
> processing a file, so I need a way that an external program check the
> progress of the script. My first idea was that the python script
> write a
> temp file showing the progress and the external program can check
> that
> file, but I think might happen file read/write locking issues.
>
> Thanks.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Hello,
One easy way would be to use a RPC system. Pyro implements one of them.
See http://packages.python.org/Pyro4/tutorials.html
This could be achieved in very few lines.
Your script create a thread in which it serves the remote requests.
xmlrpclib is another popular RPC package.
Another solution is to use a web server (sounds overkill but it isn't).
A lot of python web frameworks allow you to create such server in very few lines. look at http://www.cherrypy.org/ for instance, use their 'hello word' example and replace the 'hello word' by the current script progress and you're done.
JM
More information about the Python-list
mailing list