I have the following python 3 file:

```
import base64
import xxx

str = xxx.GetString()
str2 = base64.b64encode(str.encode())
str3 = str2.decode()
print str3

```

xxx is a module exported by some C++ code. This script does not work because calling Py\_InitModule on this script returns NULL. The weird thing is if I create a stub xxx.py in the same directory

```
def GetString() :
    return "test"

```

and run the original script under python.exe, it works and outputs the base64 string. My question is why doesn't it like the return value of xxx.GetString? In the C++ code, it returns a string object. I hope I have explained my question well enough... this is a strange error.