boost.python import


03-06-2009 18:18:58

hi all!
i use boost.python for 2 hours and i already have problems. I wanted to execute script from file like this:
from sys import version

print 'Hello World !'
number = 42
print number
print sys.version

but error has happened:
File "", line 5, in <module>
from sys import version
ImportError: __import__ not found

i use this procedure from boost.python example to execute scripts from file:
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);

// Extract an object the script stored in the global dictionary.
BOOST_TEST(python::extract<int>(global["number"]) == 42);

std::cout << "success!" << std::endl;

how i can use "import" in my scripts?
P.S. i need to use only sys and os modules