How to install sys.argv in boost :: python plugin

I am using boost::python

to integrate Python into a C ++ program. Now, I would like a Python program executed with boost::python::exec_file()

to be able to get the command line arguments of my C ++ program via sys.argv

. Is it possible?

+3


source to share


1 answer


Before your call exec_file()

(but after Py_Initialize()

you must call PySys_SetArgv(argc, argv);

, providing it to int argc

and const char *argv[]

from your program main()

.



+2


source







All Articles