> > >>> Can I allocate a second console window, so I can place certain output > > >>> to that directly, and leave the original streams alone? > > > I've rather lost track of what you're trying to do, but I would > > second Gabriel's suggestion of the standard Windows method of > > debug output: using OutputDebugString. There's an example here: > > >http://timgolden.me.uk/python/win32_how_do_i/capture-OutputDebugStrin... > > > and it shouldn't be too hard to wrap it in a file-like > > object for stderr-substitution use, say. > > > Obviously there are 1,001 other ways of doing IPC but since this > > one's ready-made you might as well use it. You can distinguish > > between different processes' outputs by virtue of the PID which > > is the first item on the mmap. > > > TJG > > I want a handle to another window. > > Create B with a command. > ___ ___ > |A | |B | > |___| |___| > > B.stdin (the stdin to B).write( '?' ) > ___ ___ > |A | |B? | > |___| |___| > > A.stdout.write( '*' ) > ___ ___ > |A* | |B? | > |___| |___|
This is a little weird. I visited your link, but couldn't make any sense of it, so I tried something else myself. I'm not even sure what it accomplishes, but if you're on a different tack or way ahead of me, that can happen. However, it might be closer than I think to what I want-- my next step is to CreateProcess in the separate executable... then try to merge in back into python and subprocess. Now I've tried: >>> p= Popen( '\\astdin.exe', creationflags= 16, stdin= PIPE ) >>> p.stdin.write( b'123\r\n' ) 5 and I get the message box (lower), but no ':' sentinel nor the output. However the p.stdin.write call still returns if I close the new console window and call it after. astdin.cpp: #include <windows.h> #include <iostream> #include <string> using namespace std; DWORD WINAPI ThreadProc( LPVOID ) { while (1) { Sleep( 1000 ); cout<< ':'; } } int main() { MessageBox( NULL, "none", NULL, 0 ); cout<< "Ok"<< endl; CreateThread( NULL, 0, ThreadProc, NULL, 0, NULL ); while (1) { string s; cin>> s; cout<< '>'; cout<< s; } return 0; } -- http://mail.python.org/mailman/listinfo/python-list