W
Wesley Henwood
To capture output from python scripts run from a C++ app I've added the
following code at the beggening of the C++ app:
PyRun_SimpleString("import grabber");
PyRun_SimpleString("import sys");
PyRun_SimpleString("class a:\n\tdef
write(self,s):\n\t\tograbber.grab(s)\n");
PyRun_SimpleString("import sys\nsys.stderr=a()\nsys.stdout=a()");
Its hard to read that way, here's what it expands to:
import grabber
import sys
class a:
def write(self, s)
grabber.grab(s)
grabber is a C++ extension, the grab function prints displays the
captured text in a Windows app. After running about 450+ scripts in a
row, I get "IOError Errno 24 Too many open files."
I've searched this group and the net and determined that stderr and
stdout may open files, is that correct? If so would each running of a
script be opening new files related to stderr and stdout and not
closing them? I'm just guessing.
following code at the beggening of the C++ app:
PyRun_SimpleString("import grabber");
PyRun_SimpleString("import sys");
PyRun_SimpleString("class a:\n\tdef
write(self,s):\n\t\tograbber.grab(s)\n");
PyRun_SimpleString("import sys\nsys.stderr=a()\nsys.stdout=a()");
Its hard to read that way, here's what it expands to:
import grabber
import sys
class a:
def write(self, s)
grabber.grab(s)
grabber is a C++ extension, the grab function prints displays the
captured text in a Windows app. After running about 450+ scripts in a
row, I get "IOError Errno 24 Too many open files."
I've searched this group and the net and determined that stderr and
stdout may open files, is that correct? If so would each running of a
script be opening new files related to stderr and stdout and not
closing them? I'm just guessing.