smathot

Segmentation fault in Expyriment

Sep 23rd, 2012
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1. # This script reliably gives segmentation faults after a few cycles, at least on
  2. # Ubuntu 12.04 x64. There appear to be two necessary conditions for the problem
  3. # to occur:
  4. #
  5. # - The window must be opened and closed repeatedly within the same script
  6. # - Fonts/ Text rendering must be involved
  7. #
  8. # This suggests, to me, that there is some kind of issue with pygame.font.init()
  9. # and/ or pygame.font.quit(), but I haven't been able to track the issue beyond
  10. # this.
  11.  
  12. from expyriment import control, stimuli
  13. import time
  14. control.defaults.initialize_delay = 0
  15. for i in range(10):
  16.     exp = control.initialize() 
  17.     print 'Control initialized'
  18.     # The TextLine constructor causes the segmentation fault. The weird thing is
  19.     # that the constructor itself appears to run and complete fine, but somehow
  20.     # after/ during the return of the constructor the segfault happens. In other
  21.     # words, the line 'Stimulus prepared' (below) is not shown, but a debug
  22.     # message at the end of the constructor *is* shown.
  23.     t = stimuli.TextLine('%d' % i)
  24.     # As far as I can tell only TextLine has this porblem, Rectangle works fine.
  25.     # t = stimuli.Rectangle( (100, 100) )
  26.     print 'Stimulus prepared'
  27.     t.present()
  28.     print 'Stimulus presented'
  29.     time.sleep(.1)
  30.     control.end()
  31.     print 'Control ended'
Advertisement
Add Comment
Please, Sign In to add comment