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