Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char** argv) {
- Py_Initialize();
- init_my_modules_and_stuff();
- // Load up the auto execution script and then open up the command prompt
- object main_module((handle<>(borrowed(PyImport_AddModule("__main__")))));
- object main_namespace = main_module.attr("__dict__");
- try
- {
- handle<> ignored(( PyRun_String( "execfile('autoexec.py')",
- Py_file_input,
- main_namespace.ptr(),
- main_namespace.ptr() ) ));
- }
- catch(...)
- {
- // If an exception was thrown, translate it to Python
- boost::python::handle_exception();
- }
- Py_Main(argc, argv);
- Py_Finalize(); // According to old Boost documentation, we don't want to do this. (???)
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement