Howdy, Stranger!

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

Supported by

OpenSesame with Python 3

Hi,

I'm not sure if this has been discussed, so I thought I might ask here.

Given the sunset of Python 2, what is the plan with some packages that are still incompatible and not available in OpenSesame with Python 3? One of my concerns is, can we communicate with EyeLink any other way than using PyGaze?

Cheers,

intan

Comments

  • Hi Intan,

    For now, the plan is to keep building also a Python 2 package, even though it won't be the default anymore. Obviously, the ideal scenario will be that PyGaze (which is the only package still not Python-3 compatible) is finally updated, @Edwin !

    Cheers,

    Sebastiaan

  • Almost there with Python 3 integration!

  • Good work!

    Sebastiaan, do you happen to have an Ubuntu ppa with the python3 package (and python3 dependencies)?

    BTW i did not notice pygaze was not finished yet in py3, it seem to install fine through pip3.

  • Hi Sebastiaan,

    Thanks, how stupid of me, I was not really awake yet. I already know this ppa and fiddled with it before.

    Did some testing today and had some problems with the plugin system. Will explain more in the rapunzel thread.

  • @sebastiaan and @Edwin ,

    sounds like good news! Thanks guys for the hard work - it's amazing :-) I will test it out tomorrow and see how it works.

  • Looks like PyGaze has been updated to Python 3 (great work @Edwin!)

    Is there any further integration that needs to be done on the OpenSesame end?

  • Hi Matt,

    Is there any further integration that needs to be done on the OpenSesame end?

    No, PyGaze is now bundled with the prerelease package of OpenSesame 3.3 based on Python 3.7. So if you download that, you can use it right away. (That being said, I anticipate that a few bugs will need to be worked out, but we'll do that as these bugs are reported.)

    Cheers!

    Sebastiaan

  • Hi @sebastiaan and @Edwin ,

    I tried out OpenSesame 3.3 on Windows 10 with an existing EEG-eyetracking experiment that previously worked on Windows 7. However, after the upgrade, there are a couple of errors I have encountered:

    1. PyGaze always throws an error of Exception: Error in libeyelink.libeyelink.__init__(): Failed to connect to the tracker! although the eye-tracker (EyeLink 1000 Plus) is on and connected to the display PC via ethernet.
    2. The error above is not unique to the combination of OpenSesame 3.3 and Windows 10, though. I tried it out with OpenSesame 3.2.8 and Windows 10, then the same error occurred. Is it then a Windows-10 thing? Is there a solution to it?
    3. The new fixation plugin on OpenSesame 3.3 does not work and throws a controls error (I forgot to save the error traceback).
    4. The PsychoPy's library to connect to the EEG parallel port (via parallel) does not seem to recognise the setPortAddress() function in the inline script because it still asks me every time to set port address...

    Thanks again for your hard work in making the software work!

    Cheers,

    intan

  • Hi Intan,

    Thanks for testing this!

    Regarding points 1 and 2, I'm going to try this in the EyeLink lab myself first.

    The new fixation plugin on OpenSesame 3.3 does not work and throws a controls error (I forgot to save the error traceback).

    Thanks, I forgot about that plugin! I don't really want people to use it anymore, because it's just a poor sketchpad really. But of course it shouldn't break, so I'll fix it.

    The PsychoPy's library to connect to the EEG parallel port (via parallel) does not seem to recognise the setPortAddress() function in the inline script because it still asks me every time to set port address...

    This may be a PsychoPy-specific issue. OpenSesame (≤ 3.2) used to include a pretty outdated version of PsychoPy (1.85), which has now finally been updated to PsychoPy 3.2.4.

    But I don't really understand what happens. What do you mean with 'it still asks me every time to set port address...?'

    Cheers!

    Sebastiaan

  • edited January 2020

    Hi Sebastiaan,

    thanks for your prompt response!

    I am not sure if the controls error is related with the fixation plugin, but even without the fixation plugin implemented, I still got the error. This time I recorded the error traceback:

    Traceback (most recent call last):
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\share\opensesame_extensions\preload_items\preload_items.py", line 50, in _preload_one_item
       item.init_edit_widget()
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libqtopensesame\items\qtautoplugin.py", line 73, in init_edit_widget
       for c in self.info[u'controls']:
    KeyError: 'controls'
    

    As for the pygaze item, I got the following error a couple of times. Is it maybe because OpenSesame 3.3 runs on Python 3.7 and the pylink package is on other Python 3.x (in this case, pylink 3.2).

    File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libqtopensesame\misc\process.py", line 158, in run
       exp.run()
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libopensesame\experiment.py", line 470, in run
       self.items.execute(self.var.start)
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libopensesame\item_store.py", line 103, in execute
       self.run(name)
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libopensesame\item_store.py", line 122, in run
       self[name].run()
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libopensesame\sequence.py", line 51, in run
       self.experiment.items.run(_item)
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libopensesame\item_store.py", line 122, in run
       self[name].run()
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\share\opensesame_plugins\pygaze_init\pygaze_init.py", line 229, in run
       **kwdict)
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\pygaze\eyetracker.py", line 67, in __init__
       from pygaze._eyetracker.libeyelink import libeyelink
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\pygaze\_eyetracker\libeyelink.py", line 29, in <module>
       from pygaze._eyetracker.eyelinkgraphics import EyelinkGraphics
     File "C:\Users\erp.users\Documents\DATA\intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\pygaze\_eyetracker\eyelinkgraphics.py", line 44, in <module>
       import pylink
    ImportError: bad magic number in 'pylink': b'l\x0c\r\n'
    

    But I don't really understand what happens. What do you mean with 'it still asks me every time to set port address...?'

    I think for now you can ignore this question because my guess is it is the issue with DLPortIO. In short, my problem is that the EEG triggers are not sent. My question is, will I have to follow the steps laid out here (although it's for Windows 7 and my PC is Windows 10 Pro)?

    Cheersies,

    intan

  • Oh, wait.

    If I use the following code to connect with the parallel port, do I still need to have dlportio.sys installed and dlportio.dll in the OpenSesame folder?

    # simplified version of how I send triggers
    
    from psychopy import parallel as p
    import numpy as np
    
    wait_time_EEG = 10 #ms
    
    # initialise the triggers
    if send_eegtriggers:
       # Address of the parallel port
       p.setPortAddress(0xC020)
       # Set all pins to low 
       p.setData(0)
       clock.sleep(wait_time_EEG)
    
    def eeg_triggers(trig): # trig is an integer
       if send_eegtriggers:
          p.setData(int(np.binary_repr(trig, 8), 2))
          clock.sleep(wait_time_EEG)
          p.setData(int(np.binary_repr(0, 8), 2)) # 0 (reset)
       else:
          print(trig)
    


  • @intanwardhani Regarding the EyeLink, the main issue is that PyLink is not built for Python 3.7, which is what OpenSesame 3.3 uses when based on Python 3 (i.e. the default). The most recent build (which you need to download from the SR Research forum) is for Python 3.6. Right now I see two workarounds, neither of which is very satisfying.

    The first would be to install OpenSesame and all its dependencies through Anaconda using Python 3.6. So building your environment, basically.

    The second would be to download the Pyhton 2.7-based package of OpenSesame, and use the pylink27-amd64 version of PyLink. Just as before, in other words, but now with the 64 bit version.

    I'll ask the SR Research people if they're planning to update PyLink for recent versions of Python. (Python 3.8 is already out.)

  • Hi @sebastiaan ,

    thanks! I will test both of the solutions you proposed and keep you updated if it works. I have already asked people from the SR Research about that, but so far no response. I read on another thread as well that they're not planning to have pylink3x above 36 in the near future (I hope I read it wrong).

    Regarding the PsychoPy's parallel library, I tried to test OpenSesame 3.3 with it and the following error came up. This error only came up with OpenSesame 3.3, but not 3.2.8. What could possibly go wrong?

    File "C:\Users\erp.users\Documents\DATA\Intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libopensesame\inline_script.py", line 92, in prepare
       self.workspace._exec(self.cprepare)
     File "C:\Users\erp.users\Documents\DATA\Intan\OpenSesame 3.3\opensesame_3.3.0a58-py3-win64-1\Lib\site-packages\libopensesame\base_python_workspace.py", line 124, in _exec
       exec(bytecode, self._globals)
     Inline script, line 15, in 
    
    # how I initialise the communication
    if send_eegtriggers:
       # Address of the parallel port
       p.setPortAddress(0xC020)
       # Set all pins to low 
       p.setData(0)
       clock.sleep(wait_time_EEG)
    
Sign In or Register to comment.