473,785 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

os.execlp and stdout

In a Python script I start a number of C++ processes using os.execlp. Most
of these processes output messages for debugging purposes at this time. The
problem I am having is that by starting 4 or 5 processes from my Python
script I don't get the cout messages they write. I have tried redirecting
stdout to a file but I get everything but the output from the C++ processes.
Any suggestions.

Thanks
Melissa
Jul 18 '05 #1
1 3583
"Melissa Wallis" <mw*****@swri.o rg> wrote in message news:<10******* ******@corp.sup ernews.com>...
In a Python script I start a number of C++ processes using os.execlp. Most
of these processes output messages for debugging purposes at this time. The
problem I am having is that by starting 4 or 5 processes from my Python
script I don't get the cout messages they write. I have tried redirecting
stdout to a file but I get everything but the output from the C++ processes.
Any suggestions.


They may be writing to stdout, but that doesn't mean it goes to your screen.
How are you starting the processes? You must first be calling fork
and then calling execlp. It would be good if you explained how you
create your child processes -- show an example from your code.
Probably your child processes are getting disconnected from your tty so their
output goes nowhere. Usually this is what you want to happen and most
fork/exec examples will do this. ... On the other hand, the very simplest
fork/exec should cause your child processes to use the
same stdout as the parent. Since you are not seeing this it makes me
suspect that your code is doing something extra to prevent this.

Yours,
Noah
Jul 18 '05 #2

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

Similar topics

4
2320
by: Leon | last post by:
"stdout" is file object, it open mode is "w" and it have a close() fuction..... while it run close(), how to reopen it because I want to do rewrite it stdout content update
4
10043
by: Paul Nilsson | last post by:
Hi, Does anyone know how to redirect text output when issuing a system or an execlp call? I have a GUI that insists on opening up a console whenever I give a system function call, and I would like to redirect the text output to a char buffer instead. Paul
6
5336
by: Erik S. Bartul | last post by:
as i understand if, the first argument of execlp() is a null terminated string containing the path of the command which to be executed. the second argument is an array of pointers to null terminated strings, containing the arguments to be passed to said command, ending in a null pointer. my question is, what does the third argument do?
9
18292
by: Santtu Nyrhinen | last post by:
Hi, Let say that I have a function like void writeHello() { printf("Hello"); } Now I need to make an automated test fot that function. The test function returns 1 for successful and 0 for unsuccessful test. int Test_writeHello() {
6
2824
by: rabidmonkey | last post by:
Hi all, I have written a server & child program both are working fine but when the server tries to execute the child program with the line execlp("child","child", parameter, NULL ); nothing happens it does not call it, yet if I test the above line by substituting child with a system binary like pwd or ls it calls it without trouble. I have used the command "chmod a+x child" to make child executable but still to run child manually at the...
5
2613
by: =?gb2312?B?yMvR1MLkyNXKx8zs0cSjrM37vKvM7NHEsru8+7z | last post by:
I wanna print the log to both the screen and file, so I simulatered a 'tee' class Tee(file): def __init__(self, name, mode): file.__init__(self, name, mode) self.stdout = sys.stdout sys.stdout = self
6
2461
by: druidamix | last post by:
I'm trying to make a gui for an application, but it not run. i'm trying to send the output of execlp to pipe and read from his father. but i don't obtain results. Any advince? Thank you. This is the code:
2
3255
by: manontheedge | last post by:
I'm trying to write a program in C on Linux where the child processes get their process images replaced. I have in my code, a few child processes that I forked from a single parent process. I'm then attempting to replace their ( the child ) process images with separate executables. I have these executables written and placed in the directory. My problem is when I'm using execlp. When it reaches execlp in my code, it does replace the...
5
8981
by: Joakim Hove | last post by:
Hello, I have written a program in C; this programs uses an external proprietary library. When calling a certain function in the external library, the particular function writes a message to stdout. I am not particularly interested in this message, and would like to silence it - however I do not know how to do it. (I stdout and stderr my self, so just redirecting into oblivion is not an option). An excerpt of the code looks like this:
0
9645
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
9480
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
9950
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
8972
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
7499
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
6739
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
5381
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...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.