PDA

View Full Version : [SOLVED] python parallel port



bschleusner
February 17th, 2008, 11:04 PM
has ANYONE been able to get python to access the parallel port? :confused:

I have been trying for days and have got know where except very frustrated. Whenever I try to do anything it just gives me a bunch of bull about how the device does not exist!?!?!

Anyone?:evil:

ghostdog74
February 18th, 2008, 01:00 AM
how are you trying to access it?

bschleusner
February 18th, 2008, 01:36 AM
I am using the pyParallel module.

import parallel
p = parallel.Parallel()

ghostdog74
February 18th, 2008, 02:28 AM
and ?? what else??

bschleusner
February 18th, 2008, 03:33 AM
I don't know, it always errors out after that. I get:


>>> import parallel
>>> p = parallel.Parallel()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/parallel/parallelppdev.py", line 189, in __init__
self.setDataDir(1)
File "/usr/lib/python2.5/site-packages/parallel/parallelppdev.py", line 509, in setDataDir
self.PPDATADIR(out)
File "/usr/lib/python2.5/site-packages/parallel/parallelppdev.py", line 458, in PPDATADIR
fcntl.ioctl(self._fd, PPDATADIR, msg)
IOError: [Errno 22] Invalid argument

do you know of a different way to send data out of the parallel port in python? What am I doing wrong with pyParallel?

zero-9376
February 18th, 2008, 03:40 AM
i ran into this same issue during my thesis, in order to use pyparallel you will need to unload the lp driver and load the ppdev driver

sudo rmmod lp
sudo modprobe ppdev

if you are going to be using the port all the time consider blacklisting the lp module.

ghostdog74
February 18th, 2008, 03:43 AM
make sure you get all installation requirement correct. Have you installed Javacomm?

bschleusner
February 18th, 2008, 04:14 AM
make sure you get all installation requirement correct. Have you installed Javacomm?
yeah, it's there.



sudo rmmod lp
sudo modprobe ppdev
It didn't seem to do anything, I keep getting the same error... What can I do to pinpoint the cause?

ghostdog74
February 18th, 2008, 04:22 AM
other areas to check maybe your BIOS, make sure if there are options to turn on/off parrallel port. Or at the Operating System, see if there are any settings about parallel ports. Also you may need to add ppdev to /etc/modules.

bschleusner
February 18th, 2008, 05:47 AM
could it be that the new kernel version has an incompatible version of fcntl, and that's why it is not working? It seems to be the end-of-the-line for the debug output....

bschleusner
February 18th, 2008, 06:23 AM
ok, I gave up on the pyParallel module, portio is working perfect. :popcorn:

thanks for all who helped!!!!

dwblas
February 19th, 2008, 05:34 PM
Please add "Solved" to the title. People periodically ask about parallel port access so adding "Solved" will point them here in the beginning. It would be good to know to try portio if pyparallel does not work.

anonymousnobody
July 21st, 2008, 10:35 PM
Did you check the permission on the actual device? I was doing stuff on the serial port and it was giving me errors. So I went into /dev/ttyS0 and changed the permissions so that I could read and write to it as "other."