[C++-sig] [Boost.Python] Importing twice causes error in MSVS with Boost.Python extension?

Lawrence Spector Lawrence.Spector at CanfieldSci.com
Wed Aug 15 16:48:34 CEST 2007

In one case I use "PyImport_ImportModule".  Later on, I do "PyRun_String".  Either way, same deal.  I import the module and the first time it succeeds.  The second time it blows up deep down in boost.  Ultimately an an assert fails, which can be traced down to boost::python::convert::registry::insert failing on an assertion of slot == 0 (line 160).  Before I go any further, has anyone else seen this problem before?  It doesn't happen on every module, just one particular one.  I even went to the trouble and removing everything it was exposing, with the same effect.  One other thing I'm doing is I have an __init__.py file in the directory, which does a "from <library> import *", as described in the tutorial.  One other interesting thing of note, is if it do it from IDLE and import this module twice, it seems to work.

Any ideas?  If not, I'll try to come up with a test case to reproduce.

Thanks in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070815/8e2962bb/attachment.htm>

More information about the Cplusplus-sig mailing list