I only get this error with anaconda3 and swig on a Mac. Does anyone have any suggestions on how to resolve this?
This is the test.i
file.
# test.i
%module test
%{
int hello();
%}
This is the test.c
file.
//test.c
#include <stdio.h>
int hello() {
printf("Hello\n");
return 0;
}
This is the compilation steps for creating the extension.
$ swig -python test.i
$ cc -c $(python3-config --cflags) test.c test_wrap.c
$ cc -bundle -L/Users/$USER/miniconda3/lib/python3.6/config-3.6m-darwin -lpython3.6m -ldl test.o test_wrap.o -o _test.so
$ python test.py
Fatal Python error: PyThreadState_Get: no current thread
[1] 97445 abort python test.py
Again, there's no error with any other operating system. They corresponding steps work. It works with Homebrew Python2 and works with Homebrew Python3. It also works with Anaconda2. But it does not work with Anaconda3 or a Anaconda3 environment.
See below for a minimal working example.