You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Wrap some code that contains WRITE statements with f2py
2. Try to capture this output on Python stdout / stderr descriptors
3. Watch yourself fail
What is the expected output? What do you see instead?
I would expect to be able to capture the text printed by wrapped routines from
inside Python.
What version of the product are you using? On what operating system?
Latest NumPy / SciPy / f2py / Python 2.7 / Linux + Windows
Please provide any additional information below.
See e.g. http://projects.scipy.org/scipy/ticket/1350 for discussion:
In essence, SciPy wraps a lot around Fortran code, e.g. for optimizers.
Unfortunately, these codes print a lot of interesting debugging (not only
debugging, actually) information on stdout / stderr and this output can not be
captured / parsed automatically from within Python.
It is possible to modify the wrappers to return more information, but it is
tedious and not practical to change every function that uses WRITE so that it
adds text to a global string that will be returned to Python.
The solution that I have in mind is to implement an extra function from within
f2py, e.g. WRITE_PYTHON which would be identical to WRITE, but actually use
PySys_WriteStdout to write to the same descriptors that Python has opened.
Probably this will also require the modification of the Fortran codes, but mass
replacement of WRITE with WRITE_PYTHON already looks much more reasonable.
Discussion and alternative solutions are welcome!
Thanks!
Original issue reported on code.google.com by yury.v.zaytsev on 3 Jan 2011 at 3:04
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
yury.v.zaytsev
on 3 Jan 2011 at 3:04The text was updated successfully, but these errors were encountered: