Parallel port in linux: No module named parallel

417 views
Skip to first unread message

Daniel Riggs

unread,
Nov 15, 2015, 12:54:48 PM11/15/15
to psychopy-users
Hello!

I'm trying to hook up a response button box that I made to the parallel port since it has millisecond-level accuracy (thanks to Matt here https://computingforpsychologists.wordpress.com/2012/04/15/how-to-make-your-own-parallel-port-response-boxes/ ), but when I import the parallel module, I get an import error (copied at the end of this post.

I wonder if it's not a bug. I looked at the offending line 29 in _linux.py, should it be "import parallel from <some_package> as pyp"? Or am I missing a dependency? Hope you can help me out. Thanks a lot,

Dan

##### Running: /home/daniel/Copy/PsychopyExperiments/ParallelPortTesting/ParallelPortTesting.py #####
Traceback (most recent call last):
  File "/home/daniel/Copy/PsychopyExperiments/ParallelPortTesting/ParallelPortTesting.py", line 89, in <module>
    pport = parallel.ParallelPort()
  File "/usr/lib/python2.7/dist-packages/psychopy/parallel/_linux.py", line 29, in __init__
    import parallel as pyp
ImportError: No module named parallel


Richard Höchenberger

unread,
Nov 15, 2015, 1:14:41 PM11/15/15
to psychop...@googlegroups.com
Hi Dan,

On Sun, Nov 15, 2015 at 6:54 PM, Daniel Riggs <daniel...@gmail.com> wrote:
> Or am I missing a dependency?

it seems you are missing the pyparallel dependency. Which Linux distro
are you using? Maybe pyparallel has already been packaged for it.
Otherwise, you can grab it from https://github.com/pyserial/pyparallel

Please be aware that the name 'pyparallel' is used for two different
projects: a multi-processing fork of Python 3, and the parallel port
interface you are looking for.

Cheers,

Richard

Daniel Riggs

unread,
Nov 15, 2015, 1:27:11 PM11/15/15
to psychopy-users
Well, of course I found the solution to this problem within a few minutes after I post, isn't it always the way ...

So yes, after looking at that _linux.py file again, it became clear that there was a missing dependency. If anyone is on linux and runs into this problem you need to install pyparallel, not to be confused with PyParallel, a separate project altogether. The files were here: http://sourceforge.net/projects/pyserial/files/pyparallel/ . You download pyparallel and unzip it, open a terminal, cd into the folder, run "python setup.py install" (I have to do so as sudo because I don't use virtualenv), after you make a quick change:

There was a bug in pyparallel's setup.py. I don't know a lot about setup files, but if you're installing for linux, you can simply comment out line 9 (#package_data = data_files), since it was setting that to 'None' anyway for linux, and whatever install operation was happening later wouldn't accept a 'None' type.

After that, it imported fine, although in my case I have new errors I'll try to fix before posting.

So maybe it would be nice to add a note to the Psychopy documentation for the 'parallel' module? That might save some time for the next odd person who is using a parallel port these days. Thanks a lot, I very much appreciate your program and your time.

Dan

Daniel Riggs

unread,
Nov 15, 2015, 1:28:17 PM11/15/15
to psychopy-users
Haha! You're fast! You responded while I was writing my next post. Thank you Richard!

Daniel Riggs

unread,
Nov 15, 2015, 2:09:53 PM11/15/15
to psychopy-users
And you're right again, Richard. Ubuntu 14.04 does have pyparallel in the repositories as python-parallel, so I could probably have just run 'sudo apt-get install python-parallel'. Talk to you later,

Dan


On Sunday, November 15, 2015 at 1:14:41 PM UTC-5, Richard Höchenberger wrote:
Reply all
Reply to author
Forward
0 new messages