Line 47 of attached .cpp produces error:
Fatal Python error: PyThreadState_Get: no current thread
Maybe you are familiar in this area and can just tell by looking what is wrong.
If not I'll need to share complete source with you. You will need an assembla acccount and I will need your username.