1
Python / Re: python-sfml strange behaviour
« on: October 09, 2013, 01:47:54 pm »
I apologize for the ambiguous title, my brain had gone to mush after trying to debug a larger application with tracebacks suppressed. For some more strange behaviour:
Only the dummy's draw method causes this, throwing an exception anywhere else will halt execution as is normal. I've read over the python-sfml source from github, unless the code there is very different to the precompiled binary I installed then I assert there is voodoo magic at play here.
import sfml as sf
window = sf.RenderWindow(sf.VideoMode(640, 480), 'Test')
class DummyDrawable(sf.Drawable):
def draw(self, *args, **kwargs):
print 'draw'
raise Exception('Sample exception')
dummy = DummyDrawable()
while window.is_open:
for event in window.events:
if isinstance(event, sf.CloseEvent):
window.close()
window.draw(dummy)
print 'Finished'
window = sf.RenderWindow(sf.VideoMode(640, 480), 'Test')
class DummyDrawable(sf.Drawable):
def draw(self, *args, **kwargs):
print 'draw'
raise Exception('Sample exception')
dummy = DummyDrawable()
while window.is_open:
for event in window.events:
if isinstance(event, sf.CloseEvent):
window.close()
window.draw(dummy)
print 'Finished'
draw
draw
draw
Finished
Exception Exception: Exception('Sample exception',) in <module 'threading' from C:\...\Python27\lib\threading.pyc'> ignored
draw
draw
Finished
Exception Exception: Exception('Sample exception',) in <module 'threading' from C:\...\Python27\lib\threading.pyc'> ignored
Only the dummy's draw method causes this, throwing an exception anywhere else will halt execution as is normal. I've read over the python-sfml source from github, unless the code there is very different to the precompiled binary I installed then I assert there is voodoo magic at play here.