Reputation: 1359
I use boost::python
to integrate Python into a C++ program. Now I would like that the Python program that is executed via boost::python::exec_file()
can obtain the command line arguments of my C++ program via sys.argv
. Is this possible?
Upvotes: 3
Views: 893
Reputation: 14619
Prior to your call to exec_file()
(but after Py_Initialize()
, you should invoke PySys_SetArgv(argc, argv);
giving it the int argc
and const char *argv[]
from your program's main()
.
Upvotes: 2