Re: Turning off text generation inside PTL

"Ernesto Adorio" <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
[email protected]> wrote:
>
>
> On Aug 22, 2006, at 10:29 PM, Ernesto Adorio wrote:
>
> > I am still using the PTL. Sometimes an imported package will output
> > text which is included in a generated html page.  For example, I
> > have to wrap in an hmtl comment block
> >
> > """<!---"""
> > import rpy
> > """-->"""
> >
> > but any text is included in the generated page though it won't be
> > displayed.  I tried redirecting sys.output but some text is still
> > showing.   I wonder how do you prevent such included unneeded
> > output messages.
>
> Maybe you could post a minimal example with this behavior.
>
> When you say it happens sometimes, do you mean that, with
> the same code, sometimes it happens and sometimes it does not?
>
>
To clarify, here is a sample code (rpy is a Python interface to R):

def Test [html] ():To clarify, here is a sample code (rpy is a Python
interface to R):

def Test [html] ():
      import rpy
      rpy.r.png(file=str("test.png")
      rpy.r.plot(rpy.r.norm(100))
      rpy.r.dev_off()
      # rest of code ...

When I call this function, there is a line

{'null device': 1}

displayed on the webpage.

This result is similar to the result of a console R session.

> png(file="test.png")
> plot.rnorm(100)
> dev.off()
null device
          1
>

Putting """<--""" before the import and """-->""" after  the rpy block
(specifically the line rpy.r.dev_off()) will prevent making a mess of
the html display.  But any lines such as {'null device': 1} will still
be be on the html page source.  I was wondering if there was
something like ptl_off() and ptl_on() available.

-Ernie

_______________________________________________
Quixote-users mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/quixote-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.