I'm trying to add some scripting capability to a program using boost:ython, and I'm having trouble getting it to load the script file. not surprisingly, there are no examples in the boost docs for exactly how to do this, so I'm basically winging it.

for the record, I hate the boost docs. they only give the most basic description of how something works within the context of boost-only code. if there is other initialization that needs to be done (Py_Initialize()), they do not mention it at all. I've found this to be the case with most of the boost tutorials and documentation that I have used. I had to accidentally find that little bit of info on a stack overflow article, which magically made my program stop crashing.

in any case, here's some code for you to ponder:
main.cpp:
Code:
int main(int argc, char *argv[])
{
  Py_Initialize();
  PySys_SetArgv(argc, argv);
  ...
}
the_file_that_is_supposed_to_load_the_script.cpp
Code:
try
{
	boost::python::object main_module = boost::python::import("__main__");
	boost::python::object main_namespace = main_module.attr("__dict__");
	//boost::python::object output = boost::python::exec(StrFormat("import test\ntest.StandardInvoiceMethod({0}, \"{1}\", \"{2}\")", siteid, startDate, endDate).c_str(), main_module);

	std::string outStr = boost::python::extract<std::string>(o);
	showvar(outStr);
}
catch (...)
{
	PyErr_Print();
}
the error I keep getting is this:
Code:
ImportError: __import__ not found
I may be way off here, but there are literally no examples out there of what I want to do, so I'm really confused, and running out of patience. I hope someone has experience with this and can help me. I don't really know what else to try.