Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get progress in python script.

38 views
Skip to first unread message

Rolando Cañer Roblejo

unread,
Sep 28, 2012, 12:26:02 PM9/28/12
to pytho...@python.org
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.

John Gordon

unread,
Sep 28, 2012, 12:36:52 PM9/28/12
to
The external program should open the progress file for read only, so I
wouldn't think file locking would be an issue.

--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

Jean-Michel Pichavant

unread,
Sep 28, 2012, 1:07:03 PM9/28/12
to Rolando Cañer Roblejo, pytho...@python.org
----- 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

Colin J. Williams

unread,
Sep 29, 2012, 10:10:29 PM9/29/12
to
Would the Python profiler meet your need?

Colin W.
0 new messages