Issue 31 in f2py: Support redirection of stdout / stderr into CPython descriptors

9 views
Skip to first unread message

f2...@googlecode.com

unread,
Jan 3, 2011, 10:08:13 AM1/3/11
to f2py-...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 31 by yury.v.zaytsev: Support redirection of stdout / stderr into
CPython descriptors
http://code.google.com/p/f2py/issues/detail?id=31

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!

f2...@googlecode.com

unread,
Apr 26, 2013, 2:42:49 AM4/26/13
to f2py-...@googlegroups.com

Comment #1 on issue 31 by yury.v.z...@gmail.com: Support redirection of
stdout / stderr into CPython descriptors
http://code.google.com/p/f2py/issues/detail?id=31

The references issue has moved: https://github.com/scipy/scipy/issues/1875

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages