问题
I've been trying to access the parallel port with pyParallel, which is in the same sourceforge as PySerial:
http://sourceforge.net/projects/pyserial/files/
I'm getting a WidowsError: exception: priviledged instruciton. Has anyone used this module before?
import parallel
p = parallel.Parallel()
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python26\lib\site-packages\parallel\parallelwin32.py", line 74, in __init__
self.ctrlReg = _pyparallel.inp(self.ctrlRegAdr)
WindowsError: exception: priviledged instruction
回答1:
Yep -- as I pondered in my comment, it's all about better sandboxing in today's Windows versions -- there's a discussion here. There's also a possible solution here (at least up to XP, you'll need to try it if you have a newer Windows version) with a Python example here. I can't try it out since I don't have any Windows around, but I hope it can help!
回答2:
I had no luck with the accepted answer.
However, this installer solved the problem for me in one shot, no fiddling with drivers:
http://sourceforge.net/projects/pyserial/files/pyparallel/giveio/
来源:https://stackoverflow.com/questions/2945160/python-access-parallel-port