zhuangjun1981 / retinotopic_mapping

visual display and analysis python code for retinotopic mapping of rodent visual cortex
http://retinotopic-mapping.readthedocs.io/en/latest/
GNU General Public License v3.0
18 stars 15 forks source link

Issue running DisplaySequence.trigger_display : pyglet problem! #16

Closed ronan-dasilva closed 5 years ago

ronan-dasilva commented 5 years ago

Hello there!

I am trying to get retinotopic_mapping up and running on my machine, but I am stuck on an issue. I am trying to run the following example code from the DisplaySequence.py file:

`

import matplotlib.pyplot as plt import retinotopic_mapping.StimulusRoutines as stim from retinotopic_mapping.MonitorSetup import Monitor, Indicator from retinotopic_mapping.DisplayStimulus import DisplaySequence mon = Monitor(resolution=(1200, 1920), dis=15., mon_width_cm=52., mon_height_cm=32.) ind = Indicator(mon) ds = DisplaySequence(log_dir='C:/data') uc = stim.UniformContrast(monitor=mon, indicator=ind, duration=10., color=-1.) ds.set_stim(uc) ds.trigger_display() `

But I am running into the following error:

File "F:\Miniconda3\envs\retinotopic_mapping\lib\site-packages\retinotopic_mapping-2.9.4-py2.7.egg\retinotopic_mapping\DisplayStimulus.py", line 389, in trigger_display color=self.initial_background_color) File "F:\Miniconda3\envs\retinotopic_mapping\lib\site-packages\psychopy-3.1.5-py2.7.egg\psychopy\visual\window.py", line 389, in __init__ self.backend = backends.getBackend(win=self, *args, **kwargs) File "F:\Miniconda3\envs\retinotopic_mapping\lib\site-packages\psychopy-3.1.5-py2.7.egg\psychopy\visual\backends\__init__.py", line 32, in getBackend return Backend(win, *args, **kwargs) File "F:\Miniconda3\envs\retinotopic_mapping\lib\site-packages\psychopy-3.1.5-py2.7.egg\psychopy\visual\backends\pygletbackend.py", line 101, in __init__ defDisp = pyglet.window.get_platform().get_default_display() AttributeError: 'module' object has no attribute 'get_platform'

I have tried just for diagnostics to run call the .get_platform() method directly on my python interpreter, but it gives the same result.

`

from pyglet import window window.get_platform() Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'get_platform' `

Could this be because of the pyglet version that was installed when I installed retinotopic_mapping (1.4.1)?

Many thanks!!

zhuangjun1981 commented 5 years ago

It has been a lot of changes from 1.4.1. The current version is 2.9.4. I would recommend installing the newest version of retinotopic_mapping. Also, it has been tested that the pyglet version 1.2.4 is working. So I will recommend using that version.

ronan-dasilva commented 5 years ago

Thanks for the quick reply, Jun!

I am indeed using retinotopic_mapping version 2.9.4. My mistake, I meant to say I am using pyglet 1.4.1 =P

Downgrading pyglet to version 1.2.4 solved the issue! Many thanks!