Python Access Parallel Port

淺唱寂寞╮ 提交于 2019-12-12 06:35:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!