I would like to trigger a python script from my C++ script. The python script is independent, I do not need to pass it anything from C++, I also do not need anything returned to C++.
I would also like to pause execution of the C++ script until the python script has finished.
I have tried the embedding solutions and the wrapping solutions offered online, but I am looking for something much simpler.
I have attempted the following.
include cstdlib
system("py "C:\path\python_script.py"");
This attempt has problems with the double quotation mark syntax. I then attempted this to deal with the double quotation mark probem.
include cstdlib
system("py " + char(34) + "C:\path\python_script.py" + char(34));
I then received the error "expression must have integral or unscoped enum type". It seems as though you can't concatenate strings this way in C++? For my final attempt, I tried to concatenate the string in pieces.
include cstdlib
string path1 = "py ";
string path2 = "C:\path\python_script.py";
string path = python_path1 + char(34) + python_path2 + char(34);
system(path);
I now receive the error "no suitable conversion function from "std::string" to "const char" exists". Any help would be greatly appreciated.