| Reference | Downloads | Github

"AttributeError" when using PsychoPy and threading

I’m trying to create an application for BCI experiments. To make sure things do not get delayed, I’m trying to implement all the steps in threads. My first simple PsychoPy program worked well, but as soon as I tried to start it from within a thread it crashes giving me the error “AttributeError: ‘NoneType’ object has no attribute ‘close’”:

pygame 1.9.6
Hello from the pygame community.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\", line 916, in _bootstrap_inner
  File "C:\Users\robotics\Documents\gitDocuments\SSVEP_EyeGaze_py\", line 29, in run
  File "C:\Users\robotics\Documents\gitDocuments\SSVEP_EyeGaze_py\", line 33, in FlickerStart
    win = visual.Window([W,H], position, monitor = 'SSVEP Paradigm', color = 'black')
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\psychopy\visual\", line 434, in __init__
    *args, **kwargs)
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\psychopy\visual\backends\", line 32, in getBackend
    return Backend(win, *args, **kwargs)
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\psychopy\visual\backends\", line 145, in __init__
    validConfigs = thisScreen.get_matching_configs(config)
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\pyglet\canvas\", line 68, in get_matching_configs
    configs = template.match(canvas)
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\pyglet\gl\", line 59, in match
    return self._get_arb_pixel_format_matching_configs(canvas)
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\pyglet\gl\", line 130, in _get_arb_pixel_format_matching_configs
    wglext_arb.wglChoosePixelFormatARB(canvas.hdc, attrs, None, nformats, pformats, nformats)
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\pyglet\gl\", line 107, in __call__
    return self.func(*args, **kwargs)
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\pyglet\gl\", line 64, in MissingFunction
    raise MissingFunctionException(name, requires, suggestions) wglChoosePixelFormatARB is not exported by the available OpenGL driver.  ARB_pixel_format is required for this functionality.

Exception ignored in: <bound method Window.__del__ of <psychopy.visual.window.Window object at 0x0000000002A1CFD0>>
Traceback (most recent call last):
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\psychopy\visual\", line 577, in __del__
  File "C:\Users\robotics\AppData\Local\Continuum\anaconda3\envs\psychopy\lib\site-packages\psychopy\visual\", line 2196, in close
    self.backend.close()  # moved here, dereferencing the window prevents
AttributeError: 'NoneType' object has no attribute 'close'
1.7421 	WARNING 	Monitor specification not found. Creating a temporary one...

Is there a proper way to implement visual.Window and threading? See below my code rough structure:

from psychopy import core, visual
import threading

class FlickThread(threading.Thread):
	def __init__(self):

	def run(self):

def FlickerStart():

	#Create the Window
	win = visual.Window([850,700], [480,180], monitor = 'SSVEP Paradigm', color = 'black')

	message = visual.TextStim(win, text = 'Flickering routine\n\nReady?')
	#Some flashing


FlickTh = FlickThread()

if __name__ == '__main__':

I tried updating the drives for my Graphics card, like suggested here but it didn’t seem to cause any effect.
Also, here are my computer specs:

Component Details Subscore Base score
Processor Intel® Core™ i5-2400 CPU @ 3.10GHz 7.4 5.1
Determined by lowest subscore
Memory (RAM) 8.00 GB 7.6
Graphics AMD Radeon HD 6450 5.1
Gaming graphics 4842 MB Total available graphics memory 6.3
Primary hard disk 733GB Free (931GB Total) 5.9
Display adapter type AMD RADEON HD 6450
Total available graphics memory 4842 MB
Dedicated graphics memory 1024 MB
Dedicated system memory 0 MB
Shared system memory 3818 MB
Display adapter driver version 15.200.1062.1004
Primary monitor resolution 1920x1080
DirectX version DirectX 10