Chris Rebert <c...@rebertia.com> wrote:
> On Mon, Apr 6, 2009 at 2:24 PM, Ronn Ross <ronn.r...@gmail.com> wrote:
> > I'm trying to print a simple string to a network printer. This is what I
> > have so far:
> >
> > import os
> >
> > printer_path = "192.168.200.139"
> > p = os.popen(printer_path, 'w')
> > p.write("this is a printer test")
> > p.close()
> >
> > I'm trying to call the printer from its IP address. When I run the script I
> > get:
> > sh: 192.168.200.139: not found
> 
> Note that os.popen() is for running /commands/, not opening files or
> IP addresses. I think you want the httplib or urllib modules instead.

Actually in this case (_writing_ text to a printer) I think you want the
Linux CUPS package for access to your remote printer, and then popen on
the 'lp' command (but use subprocess.Popen instead, that's better).

By the way, when you get closer to getting the above to work, you're
going to want to add a '\n' to the end of that string you are writing.

--
R. David Murray             http://www.bitdance.com

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to