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?
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().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With