[C++-sig] embedded python ?

Stefan Seefeld seefeld at sympatico.ca
Fri Apr 3 22:50:49 CEST 2009


mad city wrote:
> Thanks. Good advice.
>
> From the quickstart project, the embedded.cpp file function
>
>
> void exec_file_test(std::string const &script)
> {
>     std::cout << "running file " << script << "..." << std::endl;
>    
>     // Run a python script in an empty environment.
>     python::dict global;
>     python::object result = python::exec_file(script.c_str(), global, 
> global);

I'm not sure who suggested this, but I don't think this works, if the 
script runs anything interesting, as the builtin stuff is missing. (See 
the other mail for how to do it right.)

Thanks,
       Stefan


-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list