OpenGL freezes my experiment

Hi !
I built an experiment recently and when I run it, sometimes, not at the same point in the experiment I get this freeze. When I interrupt the process in the terminal I always get this :

type or paste code here  File "psypy3_test.py", line 90, in grating_inward_med
    mywin.update()
  File "/home/usr/anaconda3/envs/psypy3/lib/python3.5/site-packages/psychopy/visual/window.py", line 817, in update
    self.flip(clearBuffer=True)
  File "/home/usr/anaconda3/envs/psypy3/lib/python3.5/site-packages/psychopy/visual/window.py", line 752, in flip
    self._endOfFlip(clearBuffer)
  File "/home/usr/anaconda3/envs/psypy3/lib/python3.5/site-packages/psychopy/visual/window.py", line 1764, in _endOfFlip
    GL.glClear(GL.GL_COLOR_BUFFER_BIT)

So it’s getting mildly annoying. Any ideas on how to solve this and prevent the whole script from freezing ? I tried changing self.flip(clearBuffer=True) to self.flip(clearBuffer=False) but only gave weird output and froze again half way through.

Thanks for you help;
Jordan.