473,831 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'piping' output

Hi,

I want to know if I can 'pipe' output from a program into a python
script. Is that possible? I need to pipe some output at runtime from a
program written in C and I want to parse it/use it in a python script.
I'm new so please bear with me. thanks
Steve

Jul 18 '05 #1
2 1534


Steve wrote:
Hi,

I want to know if I can 'pipe' output from a program into a python
script. Is that possible? I need to pipe some output at runtime from a
program written in C and I want to parse it/use it in a python script.
I'm new so please bear with me. thanks
Steve


Just figured it out using popen2() :)

Steve

Jul 18 '05 #2
Steve <nospam@nopes > writes:
I want to know if I can 'pipe' output from a program into a python
script. Is that possible? I need to pipe some output at runtime from a
program written in C and I want to parse it/use it in a python
script. I'm new so please bear with me. thanks


Use the C library "popen" function.
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2765
by: Edward Diener | last post by:
From within a function in my own module I need to take the output from a Python module "A", which is sending data to stdout and which can not be changed and which I need to invoke as a top-level module, and pipe it into another function in my own module so that I can read it from stdin. Is there an easy way to do this ? The only way I can presently think to do this is through "system python A.py | python MyOwnModule.py", which seems a bit...
2
1877
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...
3
7778
by: bernd wegener | last post by:
Hello netties, I coded the following in perl: open(LOGFILE,">&STDOUT") ; if ( $ARGV ) { close(LOGFILE) ; open(LOGFILE,">> $ARGV") or die "Cannot open file $ARGV\n" ;
6
2423
by: mhenry1384 | last post by:
On WinXP, I am doing this nant.exe | python MyFilter.py This command always returns 0 (success) because MyFilter.py always succeeds. MyFilter.py looks like this while 1:
3
21404
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?
2
1130
by: Biggmatt | last post by:
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 " +...
2
3676
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
4247
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
4
1324
by: samit | last post by:
I keen to persue coding like yahoo piping system which will include drag and drop and piping features
0
10496
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10538
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
10210
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9319
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5788
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4419
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
2
3967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3077
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.