Python drives me mad...

Boris Ottlewski Boris.Ottlewski at NOSPAMsystemsoft.de
Mon Mar 20 09:54:05 EST 2000


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

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");
  Py_XDECREF(new_stdout);

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?)

bye,

Boris Ottlewski





More information about the Python-list mailing list