Hi, I have Python embedded with my other code, and when my other code opens a console and redirects stdout, stdin and stderr to it, then calls PyRun_InteractiveLoop, it immediately returns with an EOF.
After some debugging the reason for this appears to be that the stdin and stdout that the ReadLine function in the tokeniser include are not affected by my redirection and refer to a non-terminal so don't stall waiting for input from my console. This is the C code, effectively. It should suffice as an example of what I am doing, although as it is from memory, it may have minor semantic errors, please ignore them: /* This goes nowhere because the old stdin and stdout are no longer valid */ printf("Test\n"); /* This opens a console and redirects the in, out and err */ AllocConsole(); freopen("CONIN$", "r", stdin); freopen("CONOUT$", "a", stdout); freopen("CONOUT$", "a", stderr); /* I've tested stdin, stdout and stderr at this point and they all work correctly on the opened console window. */ printf("Test stdout working, isatty(stdin) = %d\n", isatty(fileno(stdin))); /* Returns 64 */ /* This call returns immediately. The stdin and stdout when the code gets to the actual reading, return isatty(fileno(x)) == 0 and so it uses the non terminal reading. */ PyRun_InteractiveLoop(stdin, "Opened Console"); Can anyone help me? I have no idea how to get Python to adopt the new stdin, stdout and stderr, but I have to assume it is pretty straightforward. Thanks. -- http://mail.python.org/mailman/listinfo/python-list