Embedded python module import errors
Question: Here's a simplest of simple python interpreter in C. What I want to is to use
.py files as a scripting language for engine hardcoded in C - running this
code (with python27.dll/lib) runs fine on machine with python.

    
    
    #pragma comment(lib,"python27.lib")
    #include <Python27/Python.h>
    
    static PyObject* emb_numargs(PyObject *self, PyObject *args)
    {
        if(!PyArg_ParseTuple(args, ":numargs"))
            return NULL;
        return Py_BuildValue("i", 1);
    }
    
    static PyMethodDef EmbMethods[] = {
        {"numargs", emb_numargs, METH_VARARGS,
         "Return 1 you dumb person."},
        {NULL, NULL, 0, NULL}
    };
    
    
    
    
      int main(int argc, char *argv[])
    { 
      FILE *fp;
      Py_SetProgramName(argv[0]);  /* optional but recommended */
      Py_Initialize();
    
    
    
      {
      int i;
          PyObject* sys = PyImport_ImportModule("sys");
      PyObject* path = PyObject_GetAttrString(sys, "path");
    
      // Add current project path to sys.path
      PyList_Append(path, PyString_FromString("."));
      for (i = 0; i < PyList_Size(path); i++)
      {
       PyString_AsString(PyList_GetItem(path, i));
      }
      Py_DECREF(sys);
       }
    
      Py_InitModule("emb", EmbMethods);
    
    
      fp = fopen("a.py", "r");
      PyRun_SimpleFile(fp, "a.py");
    
      Py_Finalize();
    
      system("pause");
      return 0;
    }
    

(a.py is just calling emb.numargs) Problem is, when I port the executable to a
computer without python installed, I get that ImportError : No Module named
site. There were some advice about setting PYTHONPATH and like, but id doesn't
work. What am I doing wrong?


Answer: Okay, I found the problem lied with having to distribute the Lib folder from
python main folder along with the executable

