psychopy.org | Reference | Downloads | Github

ModuleNotFoundError: import of 'pyglet' halted; None in sys.modules


#1

Hi everyone,

I’m using PsychoPy 3.0.4 Standalone version in a macOS HighSierra v10.13.6.

In my experiment I present images to participants. This is a simplification of it:

# Monitor parameters
mon_distance_cm = 58
refresh_rate = 60
mon_size = [1920, 1200]
mon_width = 52.1
    
# Create window component
my_monitor = monitors.Monitor('testMonitor',
                              width=mon_width,
                              distance=mon_distance_cm)
my_monitor.setSizePix(mon_size)

win = visual.Window(monitor=my_monitor,
                    fullscr=True,
                    size=mon_size,
                    allowGUI=False)

# Create global event keys
event.globalKeys.add('escape', func=core.quit, modifiers=['shift'])

# Prepare image component
image_path = '/somepath/Slide-01.png'

image = visual.ImageStim(win,
                         image=image_path,
                         units='deg',
                         size=[13, 13],
                         interpolate=True)

# Present image
for frameN in range(100):
    image.draw()
    win.flip()

for frameN in range(100):
    win.flip()
    
for frameN in range(100):
    image.draw()
    win.flip()

for frameN in range(100):
    win.flip()

Everything runs smoothly, but when the script ends I get the following message in the console:

Exception ignored in: <bound method ImageStim.__del__ of <psychopy.visual.image.ImageStim object at 0x11cfc1390>>
Traceback (most recent call last):
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/visual/image.py", line 238, in __del__
  File "/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/pyglet/gl/lib.py", line 97, in errcheck
ModuleNotFoundError: import of 'pyglet' halted; None in sys.modules

It is really bothering because this message appears everytime I’m drawing an image, which ends up to be up to 1000 times. So although everything works, this message makes it difficult to explore the outputs of my script during the experiment (e.g. number of dropped frames).

This happens on my lab’s windows machine as well, with the same Psychopy version (in Windows 7).

I tried switching to version 3.0.3 and the same message appeared. I cannot use 3.0.5 because i run into this issue in the lab’s PC. I also tried reinstalling but everything remains the same.

I tried with multiple image types and the message still appears. Sometimes it even appears when drawing a TextStim.

Do you have any suggestions? I’m guessing the module Pyglet was not properly installed, but I don’t know how to fix this issue from the Standalone Version.

Thank you very much,

Martina