stdin/stdout in Py2.1 - problem when embedding...

Anders And someone at spam.com
Thu May 17 10:39:28 CEST 2001


Hi!

I am making a Windows application that has Python embedded.
It is not a console application by nature though I do allocate the standard
console to provide input and output from Python.
The way I do this is by redirecting the std streams:
  // Redirect standard streams to our console.
  freopen("CONOUT$", "w", stdout);
  freopen("CONIN$", "r", stdin);

After this, in Python 1.5.2, everything works fine. I can access the
interpreter and recieve output in the console.
After having switched to ActivePython 2.1, I've lost the output (and
probably the input too, I am not sure). I know that Python is running well
but it just doesn't print in my console. Embedding in a native consoleapp
works the way I expect it to, but here, it doesn't
Does anybody have an idea what I am doing wrong?

Thanks,
Kristian





More information about the Python-list mailing list