V
Vincent Touquet
Hi,
In a project where I have embedded Python in a C++ application, I have
the need to replace what Python considers to be stdin, stdout and/or
stderr.
In sysmodule.c in the Python sources, I find the following lines of
code:
sysin = PyFile_FromFile(stdin, "<stdin>", "r", NULL);
....
PyDict_SetItemString(sysdict, "stdin", sysin);
Where stdin is the C constant FILE pointer and sysin is a PyObject
pointer.
Would it be feasible for me to provide my own PyFile to replace sysin
in sysdict ? It would seem to me that it would be sufficient to
provide the Python interpreter with a different standard in/out/err
than the one provide by the OS (through C).
best regards,
Vincent
In a project where I have embedded Python in a C++ application, I have
the need to replace what Python considers to be stdin, stdout and/or
stderr.
In sysmodule.c in the Python sources, I find the following lines of
code:
sysin = PyFile_FromFile(stdin, "<stdin>", "r", NULL);
....
PyDict_SetItemString(sysdict, "stdin", sysin);
Where stdin is the C constant FILE pointer and sysin is a PyObject
pointer.
Would it be feasible for me to provide my own PyFile to replace sysin
in sysdict ? It would seem to me that it would be sufficient to
provide the Python interpreter with a different standard in/out/err
than the one provide by the OS (through C).
best regards,
Vincent