[C++-sig] Can boost.python and PyQt be used together?

Paul F. Kunz Paul_Kunz at SLAC.Stanford.EDU
Sun Dec 8 23:20:08 CET 2002


>>>>> On Sun, 08 Dec 2002 16:37:14 -0500, David Abrahams <dave at boost-consulting.com> said:

> "Paul F. Kunz" <Paul_Kunz at SLAC.Stanford.EDU> writes:
>> Hmmm.  This is different from yesterday.  No sign of going thru
>> libsip.so, for example.  The only change in my code was to follow
>> David's suggestion of `return_internal_reference<>'.
>> 
>> Its beginning to look like there is really something wrong with my
>> code or my Boost.Python wrapping. :-(

> Or the way you've built your extension module. Are you embedding
> Python in a C++ application? It looks a bit like Python was never
> initialized.

   Python in not embedded.   I start Python from a UNIX shell.

> Does this code still fail when you don't exercise any SIP-wrapped
> code beforehand?

   i've moved somethings around, and now can make it fail...

[pfkeb at Kunz-pbdsl1 python]$ python
Python 2.2.2 (#1, Oct 15 2002, 07:42:56) 
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from hippo import *
>>> wc = WCFactory()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IndexError: tuple index out of range
>>> 

   This looks like the same error that didn't get a chance to printout
when run with PyQt.

Relavent code is...

WindowController * WCFactory ()
{
  WindowController * controller = WindowController::instance ();
  return controller;
}

  def ( "WCFactory", WCFactory, return_internal_reference<> () );

WindowController is a singleton, so the first call to instance() will
create one via the default constructor, or return an existing one.

WindowController::WindowController ( )
  : m_active_window ( 0 ),
    m_inspector ( 0 )
{
  s_instance = this;
}
WindowController * WindowController::instance ()
{
  if ( s_instance == 0 ) {
    s_instance = new WindowController ();
  }

  return s_instance;
}

   Are we getting close to understanding it?




More information about the Cplusplus-sig mailing list