title: Embedding python into C++ does not work as expected
body: <p>I am embedding Python into a C++ application.</p>
  
  <p>When I run the following piece of C++ code, which returns me the timestamp, it works fine.</p>
  
  <pre><code>Py_Initialize();    
  
  std::string strModule = "time"; // module to be loaded
  pName = PyString_FromString(strModule.c_str());
  pModule = PyImport_Import(pName); // import the module
  
  pDict = PyModule_GetDict(pModule); // get all the symbols in the module
  pFunc = PyDict_GetItemString(pDict, "time"); // get the function we want to call
  
  // Call the function and get the return in the pValue
  pValue = PyObject_CallObject(pFunc, NULL);
  if (pValue == NULL){
      printf('Something is wrong !');
      return 0;
  }
  printf("Return of python call : %d\n", PyInt_AsLong(pValue)); // I get the correct timestamp
  
  Py_Finalize();
  </code></pre>
  
  <p>Now I want to get the <code>sys.path</code>. But the similar code throws me error:</p>
  
  <pre><code>Py_Initialize();    
  
  std::string strModule = "sys"; // module to be loaded
  pName = PyString_FromString(strModule.c_str());
  pModule = PyImport_Import(pName); // import the module
  
  pDict = PyModule_GetDict(pModule); // get all the symbols in the module
  pFunc = PyDict_GetItemString(pDict, "path"); // get the function we want to call
  
  // Call the function and get the return in the pValue
  pValue = PyObject_CallObject(pFunc, NULL);
  if (pValue == NULL){
      printf('Something is wrong !'); // I end up here, why pValue is NULL?
      return 0;
  }
  printf("Return of python call : %d\n", PyInt_AsLong(pValue));
  
  Py_Finalize();
  </code></pre>
  
  <p>I guess the problem is that <code>time.time()</code> is a function call whereas <code>sys.path</code> is a variable. If that is the case:</p>
  
  <ol>
  <li>How to get the result of a variable? </li>
  <li>How to properly translate the result (in this case a <code>list</code>) to something meaningful in C++ for e.g. an array of strings?</li>
  </ol>
  
  <p>If not, how to proceed? I am using Python 2.7.6</p>
  
  <p>Thanks.</p>