Hi,

I was wondering if the code below is correct for adding a path to sys.path in Python. Note that this will occur before any modules have been executed/imported through Boost.Python. I'm also embedding the interpreter, which is why I am doing this. I'm not sure how it can obtain the sys.__dict__ when I haven't imported sys, so explanation on this would be helpful for me.


            using namespace boost::python;
            using namespace boost::filesystem;

            object sys = GetNamespace( "sys" );

            list syspath( sys["path"] );
            syspath.insert( 0, complete( path ).file_string() );
            sys["path"] = syspath;


Note that "path" is a boost::filesystem::path object containing the path I wish to add to sys.path.