
David Brownell wrote:
I am trying to run the hello.World class example in the tutorial and am running into problems. I can compile the dll fine, and then copy the dll (and the boost_python.dll) into my python directory, and then start my Python interpreter. The library will import, but when I call either the greet or set methods, I get the following errors from within the Python interpreter:
[greet]: Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: unbound method Boost.Python.function object must be called with World instance as first argument (got str instance instead)
[set]: Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: unbound method Boost.Python.function object must be called with World instance as first argument (got nothing instead)
I am failrly new to Python and even newer to Boost.Python, so there may be something very basic that I am missing. I am using boost 1.30, bjam to compile, MSVC 7.1, Python 2.2, and Windows XP. Note that I can compile and successfully execute the inital Hello World example (hello.cpp in the tutorial subdir).
Hi David, FYI, Boost.Python has its own mailing list. It would be nice to see you there ;-) http://mail.python.org/mailman/listinfo/c++-sig Anyway, I'm a bit lost. Could you please copy and paste the exact Python session? Have you tried the example session in the tutorial?: >>> import hello >>> planet = hello.World() >>> planet.set('howdy') >>> planet.greet() 'howdy' Regards, -- Joel de Guzman joel at boost-consulting.com http://www.boost-consulting.com http://spirit.sf.net