Bypass Sytem Output?

Jeff Bauer jbauer at rubic.com
Fri Jun 9 09:48:10 EDT 2000


Shengquan Liang wrote:
> i 'm running a Python script that generates
> an HTML file under Solaris 7.  The script also
> generates a PDF file and puts a link to it.
> 
> on thing i don't like is that Solaris gives
> a message like "saved /usr/local/apache/htdocs/PDF/1234602.pdf "
> and printed on the generated HTML file.
> 
> Q: how do i filter out this message?


It's ReportLab's pdfgen library -- not Solaris -- that
prints the message.  I hope this particular message will 
be removed in subsequent releases.  You can excise it 
yourself temporarily, by commenting out one line from 
the library source.

Alternatively, you can redirect stdout.

    >>> print "spam"
    spam
    >>> import sys
    >>> old_stdout = sys.stdout
    >>> sys.stdout=open('/dev/null','w')
    >>> print "spam"
    >>> 
    ... # perform some stdout emitting operations ...

    >>> sys.stdout = old_stdout
    >>> print "spam"
    spam
    >>> 

You may also want to sign up for reportlab's mailing
list on egroups to follow future discussions.

Jeff Bauer
Rubicon Research




More information about the Python-list mailing list