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.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=611683af7=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'frameworks': 0.05; 'implements': 0.07; 'lines.': 0.07; 'subject:How': 0.09; 'python': 0.09; 'cc:addr:python-list': 0.10; 'thread': 0.11; 'subject:python': 0.11; 'suggest': 0.11; 'file,': 0.15; "'hello": 0.16; 'temp': 0.16; 'url:packages': 0.16; 'xmlrpclib': 0.16; 'instance,': 0.17; 'package.': 0.17; 'script.': 0.17; 'all,': 0.21; 'thanks.': 0.21; 'cc:2**0': 0.23; 'example': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'external': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'done.': 0.27; 'replace': 0.27; 'issues.': 0.29; 'locking': 0.29; 'url:mailman': 0.29; 'url:python': 0.32; 'file': 0.32; '-----': 0.32; 'could': 0.32; 'url:listinfo': 0.32; 'progress': 0.33; 'another': 0.33; 'server': 0.35; 'remote': 0.35; 'but': 0.36; 'url:org': 0.36; 'subject:: ': 0.38; 'system.': 0.39; 'hello,': 0.39; 'url:mail': 0.40; 'think': 0.40; 'your': 0.60; 'easy': 0.60; 'received:194': 0.61; 'first': 0.61; 'please,': 0.62; 'subject:get': 0.81
X-IronPort-AV E=Sophos;i="4.80,503,1344204000"; d="scan'208";a="762168"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Fri, 28 Sep 2012 19:07:03 +0200 (CEST)
From Jean-Michel Pichavant <jeanmichel@sequans.com>
To Rolando CaƱer Roblejo <rolando.caner@gmail.com>
In-Reply-To <5065CF9A.6090303@gmail.com>
Subject Re: How to get progress in python script.
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Mailer Zimbra 7.2.0_GA_2669 (ZimbraWebClient - GC7 (Linux)/7.2.0_GA_2669)
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1573.1348852013.27098.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348852013 news.xs4all.nl 6952 [2001:888:2000:d::a6]:39709
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30416

Show key headers only | 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