Coming from this IPython issue: https://github.com/ipython/ipython/issues/3100
When trying to set a user defined writeconsole function in Windows, as in the example given by the rpy2 documentation here: http://rpy.sourceforge.net/rpy2/doc-2.1/html/callbacks.html#write-console
import rpy2.rinterface as rinterface rinterface.initr() buf =  def f(x): # function that append its argument to the list 'buf' buf.append(x) # output from the R console will now be appended to the list 'buf' rinterface.set_writeconsole(f) date = rinterface.baseenv['date'] rprint = rinterface.baseenv['print'] rprint(date()) # the output is in our list (as defined in the function f above) print(buf)
buf is an empty list, and does not contain the output as expected and stated in the example.
I am using IPython 0.13.1 (with Python 2.7.3 through Anaconda 1.4.0 64 bit) and rpy2 2.3.3 (installed using the binaries provided by Gohlke, which dit work!).