do anonymous pipes normally work on NT?

Florent Heyworth florent.heyworth at radbit.com
Thu Jun 17 01:55:10 CEST 1999


Bill Tutt wrote:

> > From: radbit at my-deja.com [mailto:radbit at my-deja.com]
> >
> >
> > Hi
> >
> > maybe I'm missing something about what you are looking for: here are 2
> > test scripts that work as anonymous pipes:
> >
>
> That's not the question... Anonymous pipes on NT work wonderfully. (just not
> the way we're expecting from this particular Python context)
> Calling SetStdHandle() is particularly silly as well, you shouldn't need to
> overwrite the current stdout just to get this to work.

Agreed - it was just the only way I could get it to work.

>
>
> > win32file.WriteFile(std_out, 'this method works....')
> >
>
> Calling GetStdHandle shouldn't be necessary either. The CRT already grabbed
> that information for us when Python started up.
>

True. That was just for the sake of being pedantic. Of course:
print "this method works..."
works just fine.

>
> The question is why does sys.stdout.write() not seem to work without -u when
> the above line works wonderfully.... I'm not worried about a working example
> of anonymous pipes in general, thats the easy part.

Interestingly enough I couldn't get at the outpost of testpipe.py even when
when passing "..\python -u testpipe1.py" as the command line argument in
win32process.CreateProcess().

The only workaround I found was to use SetStdHandle 8-(. Once that is done the
child process can use sys.stdout.write("this works....") without problems. For
safety I should have saved the parent's Stdout handle first.

Just a question: I'm pretty sure that this leads nowhere but: do you think what
we're seeing might have something to do with the fact that Python is built in
with multithreaded support?

Anyway - off to bed soon 8-)

Cheers
Florent Heyworth






More information about the Python-list mailing list