473,946 Members | 30,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_clicke d(self,obj):
self.notebook.s et_current_page (3)
newspost = "newspost -i " + self.newsserver .get_text() + " "
newspost += "-z " + self.port.get_t ext() + " "
if self.username.g et_text() != "":
newspost += "-u " + self.username.g et_text() + " "
if self.password.g et_text() != "":
newspost += "-p " + self.password.g et_text() + " "
newspost += "-f " + self.email.get_ text() + " "
newspost += "-n " + self.newsgroup. get_text() + " "
newspost += "-s \"" + self.subject.ge t_text() + "\" "
if self.include_fi le_x_of_y.get_a ctive():
newspost += "-q "
if self.yenc.get_a ctive():
newspost += "-y "
for row in self.listmodel:
newspost += "\"" + row[0] + "\" "

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

Apr 17 '06 #1
2 1135
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2685
by: Csaba Henk | last post by:
For me, one reason for using Python is that with the help of it I can rid of several problems that I faced with during writing scripts in Bourneish shells. Biggest of these problem was the quotation madness stemming from the typelessness of the shell language. When using Python as a shell replacement I often launch apps from Python and use different piping constructs to pass data to/get data from these apps. I expect from the language...
2
1885
by: Apple Grew | last post by:
I want to develope a Winboard like application which will support Winboard protocol. For that I require to know how to handle piping in Python. I seperated out module popen2, but when I use fileObject.readline() then it halts the program if the sub-process is waiting for user input; will executing the readline() part in a seperate thread be helpful? My target platform is Windows. Links to helpful web resources and sample Python codes...
4
2548
by: christopher diggins | last post by:
I just wanted to share this technique for piping the cout from one function to the cin of another, using the pipe operator: #include <iostream> #include <sstream> using namespace std; typedef void(*procedure)();
3
21408
by: Russ Schneider | last post by:
Is there an easy way to pipe a select statement's output to a file? -- http://www.sugapablo.com <--music ] http://www.sugapablo.net <--personal ] sugapablo@12jabber.com <--jabber IM ] ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
1
1394
by: saibotorama | last post by:
What is the Python translation for this Bash statement: tar cf - "${files}" | bzip2 "$file".tar.bz2 (Ignoring the fact that "tar cjf" also exists...) In other words, how does one pipe together arbitrary commands?
2
3683
by: moti | last post by:
I am a newbie to MySQL. I'm confused as to the piping syntax of SERVER in the User DSN in ODBC for a client PC. If I use an ip it does not work, probably because of a firewall. So I tried using named pipes and nothing seems to work. I am running MySQL on a windows xp and all the client PCs are on xp too. Named Pipes is checked as well as Enable named pipes and Socket/pipe name, which is MySQL.
3
4252
by: noob2008 | last post by:
can anyone explain me what is piping in C++ programming? for example invoice.exe < purchase.dat > statement.txt do i replace that where all the cin statements? i created a text file called purchase.dat with values: gameboy 149.99 1 ipod nano 220.99 2 DVD-player5 60.95 1
1
3067
by: AtoZ | last post by:
Hello, I'm looking for some experience translation between the software PDMS to Pro/ENGINEER ( Pro/PIPING ) and reverse. If some engineer know the solutions, their feedback will be very usefull ! Thank You Antony AtoZ
4
1330
by: samit | last post by:
I keen to persue coding like yahoo piping system which will include drag and drop and piping features
0
1472
by: jsimps44 | last post by:
Hi, I'm fairly new to c, and very new to piping and file descriptors and can't seem to get past this problem. The piping is very much not working, and I can't figure out for the life of me why. Any help at all would be greatly appreciated. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h>
0
10150
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9975
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7404
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6097
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4928
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3526
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.