473,660 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CreateProcess / redirect output

Hi,

I try to start a process on windows using win32process.Cr eateProcess and
want to to redirect the output. I set the STARTF_USESTDHA NDLES flag in the
STARTUPINFO structure. But I can not figure out, how to get the pipes
working. My app either deadlocks or displays the error messag:

....
print win32file.ReadF ile(readStdOut, 10)
pywintypes.erro r: (109, 'ReadFile', 'The pipe has been ended.')

I think I'm not the only one which needs to get the output of an external
process on windows. Is there a simpler solutions or has somebody a working
example to share?

regards,
Achim
Jul 18 '05 #1
2 4997

[Achim]
I try to start a process on windows using win32process.Cr eateProcess [...]
I think I'm not the only one which needs to get the output of an external
process on windows.


Unless you have a specific reason for using CreateProcess, you can use
os.popen*() - see http://www.python.org/doc/current/li...ewstreams.html

If you really do need to use CreateProcess, this might help:
http://msdn.microsoft.com/library/de...and_output.asp

--
Richie Hindle
ri****@entrian. com
Jul 18 '05 #2
"Richie Hindle" <ri****@entrian .com> wrote in message
news:ma******** *************** **************@ python.org...
Unless you have a specific reason for using CreateProcess, you can use
os.popen*() - see http://www.python.org/doc/current/li...ewstreams.html
The code is part of a COM object which is used in an ASP page. Using popen I
get the following error:

[Errno 5] Access is denied: 'C:\\WINDOWS\\s ystem32\\cmd.ex e /c
path_to\\Extrac tingDummy.exe "path_to\\some_ dummy.doc"'

The IUSER has the required rights on all these files. Don't know how to
solve that.
If you really do need to use CreateProcess, this might help:

http://msdn.microsoft.com/library/de...us/dllproc/bas
e/creating_a_chil d_process_with_ redirected_inpu t_and_output.as p

That looks like the info I was looking for. Thanks!

Achim
Jul 18 '05 #3

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

Similar topics

6
9239
by: david.humpherys | last post by:
os:winnt python2.3.2 I have a exe that dumps info to the command line. I want to run this process and capture the stdout into a file. I think i'm close... any help appreciated. dh -------------------------------------------------------------------------- import win32process, win32file, win32security, win32con, win32api,
7
15913
by: Donna Hawkins | last post by:
I want to use javascript to redirect to a URL which has been passed as a variable (in php). I have searched but cannot find any solution. I think this code is a basic redirect: <script type="text/javascript"> window.location = "http://www.someserver.com/somePage.html"; </script>
0
2044
by: ByteSize | last post by:
Would be grateful of advice please. I have code in VB6 working as follows: lngReply = CreateProcess(sNull, txtStart, ByVal 0&, ByVal 0&, 1&, _ NORMAL_PRIORITY_CLASS, ByVal 0&, sNull, sInfo, pInfo) but alas, the 'equivelant' vb.Net code translated as: lngReply = CreateProcess(sNull, txtStart.Text, sa, sa, 1, _ NORMAL_PRIORITY_CLASS, 0, sNull, sInfo, pInfo)
1
1976
by: DOT NET JIM | last post by:
in VB6 the api declares the createprocess lbEnv var as any. When converted to ..NET is change the type any to Object. The problem is, what kind of object. I can not get the env variables set when excuting a process with createprocess. I dont know if its the fact that VB.NET doesnt support null terminated strings, or if its createprocess that is creating the problem. I need example code, executing an console/dos exe, in its own environment...
5
7936
by: Stefano Camaiani | last post by:
Hello, please someone have the working code on how to call the CreateProcess API in Vb.Net? I need to call the CreateProcess API directly and i should not use the Vb.Net Process functions like dim MyProcess as new Process - MyProcess.Start This is my code wich i transalated from Vb6 to Vb.Net: <StructLayout(LayoutKind.Explicit, _ charset:=charset.auto)> _ Public Structure STARTUPINFO Public cb As Short
2
2011
by: Paul Schenk | last post by:
Hi All :) Would be grateful of advice please. I have code in VB6 working as follows: lngReply = CreateProcess(sNull, txtStart, ByVal 0&, ByVal 0&, 1&, _ NORMAL_PRIORITY_CLASS, ByVal 0&, sNull, sInfo, pInfo)
1
10837
by: Jai | last post by:
Please provide sample code for using Createprocess in VB.NET. The code I am using is given below. But I get "Error 91: Object referrence not set to an instance of the object" at CreateProcess calling line. Please provide some input. CODE ==== Structure STARTUPINFO Public cb As Long
18
2681
by: Jordan Glassman | last post by:
Trying to do something fairly routine... drop output into a file to graph, but the following command at the bash command line: ising output produces a blinking cursor, an empty file named "output," and a program that runs forever. With no redirect, the output is normal. Below is the printf statement used to generate output. printf("B=%4.2f E=%8.4f m=%8.4f Cv=%5.2f \
18
2661
by: Paul Lautman | last post by:
JRough wrote: What do you mean by "redirect the output to Excel"??? Excel isn't a location, it's a spreadsheet program that some (but not all users) will have on their machine. BTW, Location: is supposed to take a fully qualified URL.
0
8428
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
8341
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
8851
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...
0
8630
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
7360
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
6181
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
5650
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
4176
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
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.