|
Boost Users : |
Subject: [Boost-users] unable to load the module from simple example
From: Cuma Tyszkiewicz (cuma_at_[hidden])
Date: 2010-11-08 19:17:53
Hello
I have followed the simple example from the python boost wiki page:
my source file py_moddef.cc:
___________________________________________
#include <string>
#include <boost/python.hpp>
char const* greet()
{
return "hello, world";
}
BOOST_PYTHON_MODULE(hello_ext)
{
using namespace boost::python;
def("greet", greet);
}
____________________________________________
In the next step I have built the shared library
1. g++ -c -fpic -I/usr/include/python2.6/ py_moddef.cc
2. ld -G py_moddef.o -o libpy_moddef.so
The libpy_moddef.so file I have copied to the directory which next was included
to PYTHONPATH
>>> import sys
>>> sys.path.append("the_path")
I am not able to import the module "hello_ext" defined in py_moddef.cc, but I
am able to import each other python module from this path, so something wrong
is with the shared library.
>>> import hello_ext
ImportError: No module named hello_ext
Please explain to me what is wrong. I will be gratefull for any help.
Best regards
Cuma
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net