[C++-sig] printf from an extension (original) (raw)
Andreas Beyer beyer at fli-leibniz.de
Fri Dec 9 17:25:51 CET 2005
- Previous message: [C++-sig] printf from an extension
- Next message: [C++-sig] boost.python reference
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hans Meine wrote:
On Friday 09 December 2005 01:41, mike cantor wrote:
the "can print from in here phrase" does not reach python stdout. Is there something screwy with my environment or is there some trick to this that I don't know.
Probably you're fooled by output buffering. Try appending \n . static PyObject* helloworld(PyObject* self) { printf("can print from in here?"); return PyBuildValue("s", "hello"); }
I'm using cerr/cout all the time.
It also depends on the context where you call the function. If call from idle you won't see anything, because idle does not show the stdout output in its shell. If you call from the native python shell you should see something, at least after appending '\n'. (Or use fflush().)
Andreas
- Previous message: [C++-sig] printf from an extension
- Next message: [C++-sig] boost.python reference
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]