Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Parallel port trigger stopping

edited April 2016 in OpenSesame


I'm trying to use OpenSesame with parallel_port_trigger plug-in to trigger events in an EEG-recording software (EMOTIV's TestBench), both run on the same machine under ubuntu.

I followed the instructions (from but however my experiment is stopping right after the start with following text:

text begin =====================================


The experiment did not finish normally for the following reason:

  • Could not access the Parallel Port


  • item-stack: experiment[prepare].new_parallel_port_trigger[prepare]
  • exception message: [Errno 2] No such file or directory: '/dev/parport0'
  • time: Wed Mar 30 17:16:33 2016
  • exception type: OSError

Traceback (also in debug window)

File "/home/nkobelev/pythonTest/OpenSesame-release-3.0.7/plugins/parallel_port_trigger/", line 103, in prepare self.experiment.pptrigger = parallel.Parallel() File "/home/nkobelev/pythonTest/OpenSesame-release-3.0.7/plugins/parallel_port_trigger/", line 187, in __init__ self._fd =, os.O_RDWR) OSError: [Errno 2] No such file or directory: '/dev/parport0'

Any ideas what am I doing wrong?


  • edited March 2016

    HI Kobi,

    You need to specify the device that corresponds to the parallel port. You have specified /dev/parport0 (the default on non-Windows systems), but this device apparently doesn't exist on your system. So you will need to find out what the parallel port is called. What operating system are you using?


  • edited March 2016

    Hi Sebastiaan,

    thanks for Your fast response!

    My operating system is Ubuntu 12.04 . I didn't specify the port as it was said in the instructions that the value for port in the parallel_port_trigger is ignored under Linux. If I do specify the port the error-text remains the same.

    UPDATE: TestBench (my EEG scanning software) listens to serial port triggers not parallel port if I understand it correctly (I can choose only from ttyS0 - ttyS31).
    Is there another way to produce serial port triggers in OpenSesame?

    I tried to execute an inline_script item with following code:

    import serial
    exp.serial_port = serial.Serial('/dev/ttyS1',baudrate=19200, bytesize=serial.EIGHTBITS,stopbits=1)

    I can see /dev/ttyS0 in debug output window,
    but I can't see any trigger events in the EEG-software.

    any other ttySX return following error-text:

    The experiment did not finish normally for the following reason:
    Error while executing inline script
    - item-stack: `experiment[run].new_inline_script[run]`
    - exception type: `SerialException`
    - exception message: `Could not configure port: (5, 'Input/output error')`
    - item: `new_inline_script`
    - time: `Thu Mar 31 15:10:34 2016`
    - phase: `run`
    Traceback (also in debug window)
      File "/home/nkobelev/pythonTest/OpenSesame-release-3.0.7/libopensesame/", line 102, in run
      File "/home/nkobelev/pythonTest/OpenSesame-release-3.0.7/libopensesame/", line 159, in _exec
        exec(bytecode, self._globals)
      File "", line 5, in 
      File "/usr/local/lib/python2.7/site-packages/serial/", line 177, in __init__
      File "/usr/local/lib/python2.7/site-packages/serial/", line 300, in open
      File "/usr/local/lib/python2.7/site-packages/serial/", line 332, in _reconfigure_port
        raise SerialException("Could not configure port: {}".format(msg))
    SerialException: Could not configure port: (5, 'Input/output error')


  • edited April 2016

    I think I've found a solution. Now I can send trigger events to serial port from OpenSesame and see them in TestBench. For the case someone else has same difficulties with TestBench and OpenSesame on Ubuntu:

    Step1: open terminal and create a pair of virtual ports with socat

    sudo socat PTY,link=/dev/ttyS10,b19200 PTY,link=/dev/ttyS11,b19200

    Step2: open another terminal and grant a read/write permissions for the new ports:

    sudo chmod o+rw /dev/ttyS10
    sudo chmod o+rw /dev/ttyS11

    Step3: open OpenSesame and create an inline_script item.
    in that item write:

    import serial
    s = serial.Serial('/dev/ttyS10',baudrate=19200,

    Step4: open TestBench, go to marker->configure serial port and select the same port as You created with socat (ttyS11 in my case) and set bit per seconds to the same rate as you specified in socat (19200 in my case).

    That's It! Now as You execute the inline_script in OpenSesame You should see an event with a value=1 in TestBench.

    I hope it works for You too!


Sign In or Register to comment.