If this template helps then use it. If not then just delete and start from scratch.
OS Ubuntu 22.04 LTS
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I want to send port-triggers via the parallel port to a recording computer. The computer runs Ubuntu 22.04 LTS. I am not familiar with Ubuntu.
The experiment, built with Builder, chrashes with the error message that there is not such port. I tried all ports offered to me by PsychoPy, e.g. parport0 and parport1. A psychophysics-toolbox program can write to the port with the address ‘0378’. So, it is technically possible. How or where do I tell PsychoPy to use this address?
Thanks a lot for any help Jens
Hello
here is the error message
Running: /home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject_lastrun.py
13.1966 INFO Loaded monitor calibration from [‘2025_02_19 14:59’]
13.2144 INFO Loaded monitor calibration from [‘2025_02_19 14:59’]
0.6200 WARNING Monitor specification not found. Creating a temporary one…
Traceback (most recent call last):
ioHub Server Process Completed With Code: 0
File “/home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject_lastrun.py”, line 2364, in
run(
File “/home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject_lastrun.py”, line 462, in run
p_port = parallel.ParallelPort(address=‘/dev/parport0’)
File “/home/busch/.psychopy_py310/lib/python3.10/site-packages/psychopy/parallel/_linux.py”, line 41, in init
self.port = pyp.Parallel(address)
File “/home/busch/.psychopy_py310/lib/python3.10/site-packages/parallel/parallelppdev.py”, line 190, in init
self.PPCLAIM()
File “/home/busch/.psychopy_py310/lib/python3.10/site-packages/parallel/parallelppdev.py”, line 221, in PPCLAIM
fcntl.ioctl(self._fd, PPCLAIM)
OSError: [Errno 6] No such device or address
################# Experiment ended with exit code 1 [pid:9083] #################
Thanks a lot for any help
Best wishes Jens
Do you see anything if you type ls /dev/ | grep par
in a terminal? e.g.
$ ls /dev/ | grep par
parport0
Hello @aforren1
yes, I see parport0 and parport1 with ls /dev | grep par
.
I specified the parallel port in the Builder as follows
The parallel port is set in the preferences as follows
So, it should in principle work, shouldn’t it?
Best wishes Jens
Hmm, I would think so?
I just tried a Builder task with just the parallel component (in v2024.2.4), and it was happy? The only other straightforward thing that comes to mind would be that the user isn’t a member of the lp
group (or whichever one is relevant to parallel port access), but that shouldn’t be it if a PTB task works…
Have you tried a script like
from psychopy import parallel
parallel.ParallelPort(address=‘/dev/parport0’)
or
import parallel
p = parallel.Parallel()
Just to cut out the Builder as a cause?
Hello @aforren1
I can give it a try on Monday. Thanks a lot.
Best wishes Jens
Hello @aforren1
The two min toy experiments with
from psychopy import parallel
parallel.ParallelPort(address = '/dev/parport0')
or
import parallel
p = parallel.Parallel()
exit with no error. This is really strange on line 21 of my experiment parallel
is imported
from psychopy import sound, gui, visual, core, data, event, logging, clock, colors, layout, hardware, parallel
It is then initialized in the routine in which it is first called.
p_port = parallel.ParallelPort(address='/dev/parport0')
Still the error remains
File "/home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject.py", line 2364, in <module>
run(
File "/home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject.py", line 462, in run
p_port = parallel.ParallelPort(address='/dev/parport0')
File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/psychopy/parallel/_linux.py", line 41, in __init__
self.port = pyp.Parallel(address)
File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/parallel/parallelppdev.py", line 190, in __init__
self.PPCLAIM()
File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/parallel/parallelppdev.py", line 221, in PPCLAIM
fcntl.ioctl(self._fd, PPCLAIM)
OSError: [Errno 6] No such device or address
More ideas?
Best wishes Jens
Weird! Only other thought is that the port is claimed by something else? I don’t actually know very much about it, but it looks like PPCLAIM will fail if another program has already claimed the port with PPEXCL? See here. I wonder if pyparallel or ppdev on the MATLAB side doesn’t clean up properly? Easy check would be to reboot, then run the Builder task.
One other guess-- if you have multiple instances of the Parallel component in Builder, I think they’d conflict? I.e. if you make multiple parallel port objects with the same address, the second one instantiated would fail because the port’s already been exclusively claimed?
Hello
I doubt the port is being used. The computer is turned off and on after each experiment.
Currently I only have one parallel port component. So this tip does not address the problem.
I wonder if it is a problem that I am running Psychopy in a virtual environment?
Best wishes Jens
I wouldn’t think a Python virtual environment would make a difference, unless you happen to mean some container env (e.g. Docker, …). For one data point, the Builder test I did was running from a Python 3.10 venv.
Can you share the PsychoPy version & task code?
I certainly find that I can’t do while running in a VS Code virtual environment (plugin/external library related). Can you test?
Hello
I will be able to share the code tomorrow. Today, I do not have access to the stimulation PC.
Best wishes Jens
Hello
I created a toy-vesion of my experiment. It just try to send one trigger to the parallel port.
TestPPort.psyexp (8.5 KB)
The error message changed however.
File "/home/busch/Documents/JEBAR/TestPPort_lastrun.py", line 593, in <module>
run(
File "/home/busch/Documents/JEBAR/TestPPort_lastrun.py", line 365, in run
p_port = parallel.ParallelPort(address='/dev/parport0')
File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/psychopy/parallel/_linux.py", line 41, in __init__
self.port = pyp.Parallel(address)
File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/parallel/parallelppdev.py", line 187, in __init__
self._fd = os.open(self.device, os.O_RDWR)
PermissionError: [Errno 13] Permission denied: '/dev/parport0'
Now, the device seems to found but I have not the permission to address it.
Best wishes Jens
I think that suggests
though it still doesn’t make sense with the PTB success. What does typing groups
in the terminal say? Any chance the PTB task is being run as the root user?
Hello
I have given up using the parallel port. I do not know why I cannot access it from within PsychoPy. I am using a USB interface now.
Best wishes Jens