Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-28-2005, 12:27 PM   #1
Registered: Apr 2003
Location: boston
Distribution: ubuntu debian redhat fedora
Posts: 108

Rep: Reputation: 15
best practices for subprocs & pipes in python

could some who keeps more up to date than i tell me what the current preferred way of running a sub process is in python?

should i be using os.popen, popen2, subprocess.Popen, etc?

and a similar question,

is it possible to create a pipe to just a shell, keeping it open for later commands?

i was trying to create a single object (e.g. shell) that i could read and write to, like a shell command line, something lie this

    shell.write('command -to run')
    output = shell.readlines()
    print 'this went wrong', shell.stderr
i tried this a few ways, and never could get all the pipes working. i either get file errors or it loops indefintely (atleast until i hit ctrl+c) while reading.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
pipes in python? SciYro Programming 9 08-02-2006 09:35 AM
Superkaramba & Python iZvi Linux - Software 7 11-24-2004 03:57 PM
[Perl] brainstorming with pipes & commands patator Programming 3 06-25-2004 04:17 AM
Xchat & Python nixdisciple Linux - General 1 06-03-2002 04:54 AM
Python & Linux Relfx Linux - Newbie 1 08-17-2001 03:59 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration