Error loadin wxpython application

Hi,
I have just built and installed wxPython 2.8.8.1 (based on wxGTK, which I have also just built), and when I try my test application, it fails with the following error:

  File "wxtestapp.py", line 422, in ?
    app = Application(0)
  File "wx/_core.py", line 7913, in __init__
    self._BootstrapApp()
  File "wx/_core.py", line 7487, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "wx/_core.py", line 7922, in OnPreInit
    wx.StockGDI._initStockObjects()
  File "wx/_gdi.py", line 6181, in _initStockObjects
    wx.TheFontList.this = _wxPyInitTheFontList().this
AttributeError: 'NoneType' object has no attribute 'this'

I am assuming that I have built wxPython (and/or wxGTK?) incorrectly. But I don't have the slightest idea as to how to go about fixing this. Any pointers/advice would be very helpful.

Thank you
-MG

Moe Goldberg wrote:

Hi,
I have just built and installed wxPython 2.8.8.1 (based on wxGTK, which I have also just built), and when I try my test application, it fails with the following error:

File "wxtestapp.py", line 422, in ?
   app = Application(0)
File "wx/_core.py", line 7913, in __init__
   self._BootstrapApp()
File "wx/_core.py", line 7487, in _BootstrapApp
   return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "wx/_core.py", line 7922, in OnPreInit
   wx.StockGDI._initStockObjects()
File "wx/_gdi.py", line 6181, in _initStockObjects
   wx.TheFontList.this = _wxPyInitTheFontList().this
AttributeError: 'NoneType' object has no attribute 'this'

I am assuming that I have built wxPython (and/or wxGTK?) incorrectly. But I don't have the slightest idea as to how to go about fixing this. Any pointers/advice would be very helpful.

_wxPyInitTheFontList is C++ code that looks like this:

     wxFontList* _wxPyInitTheFontList() { return wxTheFontList; }

wxTheFontList is a global pointer that should have been initialized during the C++ part of the BootstrapApp before it called OnPreInit, but apparently in your case it is not doing so and is returning NULL instead, which the wxPython wrapper is turning into None.

So the thing to do would be to use the debugger and put a breakpoint somewhere in the startup/initialization code and trace it through and find out why wxInitializeStockLists is either not getting called or is being called but the allocation of the stock list objects is failing.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!