A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-July/067023.html below:

[Python-Dev] Patch for commands.py to provide callback

[Python-Dev] Patch for commands.py to provide callback [Python-Dev] Patch for commands.py to provide callbackBrad Doctor brad.doctor at gmail.com
Wed Jul 5 17:35:50 CEST 2006
Because it is a great way to consistently use popen().  Rather than write
something specific each time, our site/company prefers to use commands to
keep it all consistent.

-brad

On 7/5/06, Guido van Rossum <guido at python.org> wrote:
>
> Since commands.getstatusoutput() is such a trivial wrapper around
> os.popen(), why bother patching commands.py?
>
> On 7/5/06, Brad Doctor <brad.doctor at gmail.com> wrote:
> > Greetings all,
> >
> > I have attached a patch for commands.py to provide a callback ability.
> > Example use:
> >
> > -------------------------------------
> > import commands
> >
> > cmd = 'top -b -n2'
> >
> > def fancy(out):
> >      print 'GOT(%s)' % out.strip()
> >
> > commands.cb = fancy
> >
> > (s,o) = commands.getstatusoutput(cmd)
> > print 'OUTPUT (%s)' % o
> > -------------------------------------
> >
> > I am not sure if this is the proper forum or means to submit something
> like
> > this, so please forgive me and advise accordingly if I am in error.  The
> > basic idea is obvious, to allow long-running commands to call back
> whenever
> > there is output.  This is against python 2.4.  Please let me know if you
> > have any questions or suggestions.
> >
> > thanks!!
> > -brad
> >
> > _______________________________________________
> > Python-Dev mailing list
> > Python-Dev at python.org
> > http://mail.python.org/mailman/listinfo/python-dev
> > Unsubscribe:
> > http://mail.python.org/mailman/options/python-dev/guido%40python.org
> >
> >
> >
> >
>
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060705/5eb2f554/attachment.html 
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4