Python drives me mad...

Boris Ottlewski Boris.Ottlewski at
Mon Mar 20 15:54:05 CET 2000

Last attempt to get the result from python in embedded mode. (I am about to

I do this:

  FILE *stream;
  char temp[8192];
  new_stdout = PyFile_FromString("c:\\freopen.out", "w");
  PySys_SetObject("stdout", new_stdout);
  file://PySys_SetObject("stderr", new_stdout);
  int res = PyRun_SimpleString("print 2\n");

This should print the "2" to the redirected stdout which is c:\freopen.out.
But the file is empty!!!!!!!!!! and...I cant delete it, it is still locked
(shouldnt Py_XDECREF close it?)


Boris Ottlewski

More information about the Python-list mailing list