print from a python script.

Chris Rebert clp2 at
Mon Apr 6 23:28:57 CEST 2009

On Mon, Apr 6, 2009 at 2:24 PM, Ronn Ross <ronn.ross at> wrote:
> I'm trying to print a simple string to a network printer. This is what I
> have so far:
> import os
> printer_path = ""
> 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: 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.


I have a blog:

More information about the Python-list mailing list