473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Question: spawn and redirection

On Windows, what is the proper way to spawn an executable and redirect its
stdout and stderr.
Thanks for any help,

Károly
Jul 18 '05 #1
6 2534
"Ladvánszky Károly" wrote:

On Windows, what is the proper way to spawn an executable and redirect its
stdout and stderr.


Redirect them where? The answer might well be different (e.g. os.system vs.
os.popen) if you are redirecting them to a file versus redirecting them back
to the calling program.

-Peter
Jul 18 '05 #2
I'd like to redirect the program output into a file.

"Peter Hansen" <pe***@engcorp.com> az alábbiakat írta a következo
hírüzenetben: 40***************@engcorp.com...
"Ladvánszky Károly" wrote:

On Windows, what is the proper way to spawn an executable and redirect its stdout and stderr.
Redirect them where? The answer might well be different (e.g. os.system

vs. os.popen) if you are redirecting them to a file versus redirecting them back to the calling program.

-Peter

Jul 18 '05 #3
Ladvánszky Károly wrote:
On Windows, what is the proper way to spawn an executable and redirect its
stdout and stderr.
Thanks for any help,

Károly

os.spawnv(os.P_NOWAIT, r'c:\WINNT\system32\cmd.exe', ('/C dir > dir.txt',))

does a trick for me.

regards,
anton.
Jul 18 '05 #4
"Ladvánszky Károly" wrote:

I'd like to redirect the program output into a file.


I'd just us os.system then, as in

os.system('command >somefile')

-Peter
Jul 18 '05 #5
Thanks for your advice. os.system() is not suitable in all cases as it
always waits for the started process to terminate.

"Peter Hansen" <pe***@engcorp.com> az alábbiakat írta a következo
hírüzenetben: 40***************@engcorp.com...
"Ladvánszky Károly" wrote:

I'd like to redirect the program output into a file.


I'd just us os.system then, as in

os.system('command >somefile')

-Peter

Jul 18 '05 #6
"Ladvánszky Károly" wrote:

Thanks for your advice. os.system() is not suitable in all cases as it
always waits for the started process to terminate.

"Peter Hansen" <pe***@engcorp.com> az alábbiakat írta a következo
hírüzenetben: 40***************@engcorp.com...
"Ladvánszky Károly" wrote:

I'd like to redirect the program output into a file.


I'd just us os.system then, as in

os.system('command >somefile')


On Windows, you would simply to this instead then, I believe:

os.system('start command >somefile')

-Peter
Jul 18 '05 #7

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

Similar topics

5
by: Richard P | last post by:
I need some help on timers. My app is asp.net 1.1 website running in a shared hosting environment with a third-party service provider. I currently request and cache 20 - 40 remote RSS feeds. When a...
17
by: Materialised | last post by:
Ok, I need some info on how to print in colours to the xterm using c. take a simple program #include <stdio.h> voice main(void) { printf("I want this in colour\n"; return 0; }
23
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the...
3
by: somuchh8 | last post by:
Hi, I'm having a lot of trouble with the Win32::Spawn module in perl. Here is my situation, I have a Win32::Spawn call which looks like this: my $success = undef; my $cmdline =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.