   PythonC reading string from PyDict
  Hi,I'm using python to set up a rendering engine. The settings are stored in the script file as dictionary objects.eg:RenderInfo = {};RenderInfo['Title']  = "Simple Python Test"; #window TitleRenderInfo['ScreenWidth']  =  640;........I'm trying to read this in C++ like thisPyObject *renderInfo,*renderStats;renderInfo = PyDict_GetItemString(pDict,"RenderInfo");renderStats = PyDict_GetItemString(renderInfo,"Title");char* title = PyBytes_AsString(renderStats);//Also Tried  PyBytesArray_AsStringprintf("%s\n",title);  // Prints NULLrenderStats = PyDict_GetItemString(renderInfo,"ScreenWidth");int sw = PyLong_AsLong(renderStats);printf("%d\n",sw); // prints 640All other types work, but the string's fail and return NULL. This is the first time I'm using the PyBytes_AsString function since it replaced PyString_AsString in version 3.1.Does Anyone know why this is not working ? Thanks!   
  You're storing unicode strings in the dict but trying to treat those objects as byte strings. I suggest storing byte strings in your settings file instead, if this is not a user-facing file. Alternatively you'll probably need some method on the unicode object to get what you want from it, probably the PyUnicode_Encode method with "UTF-8" as the encoding.   