To simplify my problem, I made a small project showing my use of python and
c++. Without any ui, any wxWidgets, any file operations. Only simple
console application executed python script. Here it is:
*cppFile.cpp*
#include <Python.h>
#include <iostream>
int main()
{
PyObject *pModule, *pClass, *pArgs, *pInstance, *pMethod;
Py_Initialize();
std::cout << "FirstCPPString" << std::endl;
pModule = PyImport_ImportModule("PythonApplication1");
pClass = PyObject_GetAttrString(pModule, "Importer");
pArgs = Py_BuildValue("()");
pInstance = PyEval_CallObject(pClass, pArgs);
Py_DECREF(pModule);
Py_DECREF(pClass);
Py_DECREF(pArgs);
pMethod = PyObject_GetAttrString(pInstance,"start");
pArgs = Py_BuildValue("()");
PyEval_CallObject(pMethod, pArgs);
Py_DECREF(pInstance);
Py_DECREF(pMethod);
Py_DECREF(pArgs);
Py_Finalize();
std::cout << "SecondCPPString" << std::endl;
}
PythonApplication1.py
print ('FirstPythonString')
class Importer:
def start(self):
print('SecondPythonString')
And, when I start project in visual studio here is my result:
[image: result.PNG]
And after starting project in visual, I get exe file, as a result of
compile. But it's only exe with cpp file. Without .py file placed in the
same folder, I got an error after running exe. And what I want, is, let's
say, combine existing exe with .py file to one exe. I hope I said it clear.
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyinstaller/1141b48e-8ebe-4b54-9d2f-cb1e846e1501o%40googlegroups.com.