Doesn't anybody write to paper anymore?

Randall Hopper aa8vb at yahoo.com
Fri Apr 14 13:39:55 EDT 2000


Alex:
 |> I would like to pass it into the queue.  IO redirection in the shell
 |> is ugly and awkward.
 |
 |I don't know whether this counts as ugly and awkward IO redirection, but
 |perhaps you could do something like this:
 |
 |from os import popen
 |printer = popen ('lpr')
 |printer.write("page 1\n\r\f")
 |printer.write("page 2\n\r\f")
 |printer.close ()

If it doesn't work, try lp instead of lpr.
Try a test from the shell (command window) and see what works:

     echo "This is an lpr test" | lpr
     echo "This is an lp  test" | lp

Note that both assume you or someone has configured the printing service on
this box (possibly not the case for a home FreeBSD or Linux box).  If this
hasn't been done, search your OS documentation (printcap, lpd, and lpsched
are useful search strings).

-- 
Randall Hopper
aa8vb at yahoo.com




More information about the Python-list mailing list