[C++-sig] Indexing suite v2 multiple module problem

2012-07-25 Thread John Reid
Hi,

I'm using a version of the indexing suite I believe I copied from
Roman's codebase some time ago. I've recently refactored my project into
multiple modules and now I'm have some runtime errors when iterating
over sequences in python. At runtime I get the cryptic message:

RuntimeError: get

It is proving a little difficult to track down as it only happens on my
server not on my development machine although it is reproducible every
time. Not all std::vectors that are exposed trigger the error. If I
change the order that my C++ modules are imported then the std::vector
that triggers the error changes.

I'm building a debug python on my server to try to investigate further
but meanwhile I wonder if anyone had any suggestions or had seen this
sort of thing before?

Also where is the latest version of the indexing suite v2 code that I
could use?

Thanks,
John.

___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Indexing suite v2 multiple module problem

2012-07-25 Thread Roman Yakovenko
On Wed, Jul 25, 2012 at 11:03 AM, John Reid  wrote:
> Hi,
>
> I'm using a version of the indexing suite I believe I copied from
> Roman's codebase some time ago. I've recently refactored my project into
> multiple modules and now I'm have some runtime errors when iterating
> over sequences in python. At runtime I get the cryptic message:
>
> RuntimeError: get
>
> It is proving a little difficult to track down as it only happens on my
> server not on my development machine although it is reproducible every
> time. Not all std::vectors that are exposed trigger the error. If I
> change the order that my C++ modules are imported then the std::vector
> that triggers the error changes.
>
> I'm building a debug python on my server to try to investigate further
> but meanwhile I wonder if anyone had any suggestions or had seen this
> sort of thing before?
>
> Also where is the latest version of the indexing suite v2 code that I
> could use?

Do you use dlopen?

import sys
sys.setdlopenflags(RTLD_NOW | RTLD_GLOBAL)

In multi-module environment you have to share boost python registry.

I would start with this. You can google for "boost python dlopen" and
find a lot of information about the subject.

If I remember right, Py++ contains (generates) some code that queries
the registry and registers the class conditionally.

HTH,
Roman
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Indexing suite v2 multiple module problem

2012-07-25 Thread John Reid


On 25/07/12 09:44, Roman Yakovenko wrote:
> Do you use dlopen?
>
> import sys
> sys.setdlopenflags(RTLD_NOW | RTLD_GLOBAL)
>
> In multi-module environment you have to share boost python registry.

(Sorry if this is a duplicate post, the last one seemed to disappear)

Thanks, your advice fixed it:

#
# Need to set dlopen flags for multi-module boost.python environment
#
import sys, DLFCN
sys.setdlopenflags(DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL)

___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig