469,917 Members | 1,859 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

piping question

I have been working on a little frontend for newspost. It runs
newspost just fine and gets it's output. The problem is that i want it to
get the stdout as the program runs, not hold it all till it's
finished. I've tried a few variations of popen , and others with no luck.

Here is the subroutine that executes newspost:

def on_BT_go_clicked(self,obj):
self.notebook.set_current_page(3)
newspost = "newspost -i " + self.newsserver.get_text() + " "
newspost += "-z " + self.port.get_text() + " "
if self.username.get_text() != "":
newspost += "-u " + self.username.get_text() + " "
if self.password.get_text() != "":
newspost += "-p " + self.password.get_text() + " "
newspost += "-f " + self.email.get_text() + " "
newspost += "-n " + self.newsgroup.get_text() + " "
newspost += "-s \"" + self.subject.get_text() + "\" "
if self.include_file_x_of_y.get_active():
newspost += "-q "
if self.yenc.get_active():
newspost += "-y "
for row in self.listmodel:
newspost += "\"" + row[0] + "\" "

pipe = os.popen(newspost)
while 1:
output = pipe.read()
if not(output):
break
textiter = self.textbuffer.get_end_iter()
self.textbuffer.insert(textiter, output)
pipe.close()

Apr 17 '06 #1
2 1033
Have you tried running python with '-u'? That turns off most buffering
within python at least. I'm not familiar with newspost, so I've no
idea what to do about any output buffering it might be doing.

Apr 17 '06 #2
In article <pa***************************@biggmatt.com>,
Biggmatt <ma**@biggmatt.com> wrote:
The problem is that i want it to
get the stdout as the program runs, not hold it all till it's
finished.


This has been discussed before. If the program you're trying to control
buffers its output and gives no option to disable that, then you're
stuck with the way it works.
Apr 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Csaba Henk | last post: by
2 posts views Thread by Apple Grew | last post: by
4 posts views Thread by christopher diggins | last post: by
3 posts views Thread by Russ Schneider | last post: by
1 post views Thread by saibotorama | last post: by
2 posts views Thread by moti | last post: by
3 posts views Thread by noob2008 | last post: by
4 posts views Thread by samit | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.