Writing to the parallel port (Mem 0x378) when runnning WinXP or Mandrake 9.2

Derrick 'dman' Hudson dman at dman13.dyndns.org
Fri Dec 5 16:34:28 EST 2003


On 4 Dec 2003 00:54:11 -0800, Todd Gardner wrote:
> ---------------------------------------------------------------
> I would appreciate any ideas how to write to the parallel port (Mem
> 0x378) when runnning WinXP or Mandrake 9.2.

On the linux side, the following code works :
    f = file('/dev/lp0', 'w')
    f.write( "Some Data" )
    f.close()

This assumes that the parallel port you wanted to write to is the
first one.  (I have no idea what the memory addresses are, and I don't
care either :-))

If you are trying to print something, though, I'd recommend not
accessing the device directly.  On linux use the popen() call to
invoke /usr/bin/lp and let the print server handle the actual hardware.

If you are trying to interact with some other parallel port device,
then some abstraction layer like the recommended PyParallel would be
better for production.

-D

-- 
Better a little with righteousness
than much gain with injustice.
        Proverbs 16:8
 
www: http://dman13.dyndns.org/~dman/            jabber: dman at dman13.dyndns.org




More information about the Python-list mailing list