python and I/O

Carey Evans c.evans at clear.net.nz
Sun Sep 26 06:53:41 EDT 1999


"Mike Linnen" <mlinnen at usa.net> writes:

> I want to access both serial and parallel I/O ports.  Looks like the serial
> port is faily straight forward using termios but how would I write/read from
> the parallel port?

Writing looks even more straightforward:

>>> p = open('/dev/lp0', 'wb')
>>> p.write('VOOM!\r\n\f')
>>> p.flush()
>>> p.close()

This prints "VOOM!" on the top of the paper in the printer and ejects it.

I don't know how you would go about actually reading data from the
parallel port, though.  The Linux printer driver, for example, doesn't 
support it.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	       "This is where your sanity gives in..."




More information about the Python-list mailing list