Share via

Run a python module from C++

Duane Perry 1 Reputation point
2021-03-19T19:52:40.447+00:00

I am trying to run a VS python file from VS C++. The following ... PyObject* pName, * pModule,.... pName = PyUnicode_FromString("<filename>.py"); pModule = PyImport_Import(pName); .... Py_Finalize(); The pModule is always NULL. pName have values. I am using Python 3.7. The Python application runs fine. When I try to call it from the C++ app, I get NULL. Suggestions?

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.