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


Groups > comp.lang.python > #30416 > unrolled thread

Re: How to get progress in python script.

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2012-09-28 19:07 +0200
Last post2012-09-28 19:07 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

#30416 — Re: How to get progress in python script.

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2012-09-28 19:07 +0200
SubjectRe: How to get progress in python script.
Message-ID<mailman.1573.1348852013.27098.python-list@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web