Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30416

Re: How to get progress in python script.

Date 2012-09-28 19:07 +0200
From Jean-Michel Pichavant <jeanmichel@sequans.com>
Subject Re: How to get progress in python script.
Newsgroups comp.lang.python
Message-ID <mailman.1573.1348852013.27098.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to get progress in python script. Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-09-28 19:07 +0200

csiph-web