Re: [Gtk-osx-users] Debugging PyGTK bundles.

On May 19, 2011, at 1:07 PM, Dwayne Bailey wrote:

> On 2011-05-19 16:48, John Ralls wrote:
>> On May 19, 2011, at 4:37 AM, Dwayne Bailey wrote:
>>> Hi,
>>> Good news.  My app mostly launches on 10.6 and 10.5.  On my machine 10.6
>>> machine it runs quite well.  But the bundle on a 10.5 machine and on
>>> someone else's 10.6 machine starts but then repeatably gives me the
>>> spinning pizza after a few actions.
>>> I get no tracebacks related to the hang so I was wondering how people on
>>> this list try to debug their bundled PyGTK apps.  I've used -v when
>>> launching which helped me trace some issues.  I haven't tried to use pdb.
>>> How do you do it? Help much appreciated.
>> You didn't say which Gramps launcher you used. The latest version passes control to a short python preamble that sets things up then passses control to Gramps by importing on the last line. Instead of using $PYTHONPATH it sets up sys.path in the preamble. (The motivation was to get better control of language settings.) It did take a couple of tries to notice that I needed to set $PYTHONHOME to force it to use the python libraries in the bundle. I think that that wasn't so much of a problem before because the Apple-provided python libraries worked well enough, but with 2.7 in the bundle they don't. The need for lib/python2.7/config/ and include/python2.7 is a new requirement for 2.7 (2.6 and before didn't require it). It's in the Gramps bundle file but I haven't yet copied it to the examples in ige-mac-bundler.
> I used the one from gtk-osx source checkout.  At the moment I'm using a 
> combination of the pygtk-demo and the python launcher you mention.
> So seems like I've discovered the long way that PYTHONHOME and those 
> includes are needed, thanks for confirming.  I could just go back to the 
> new gramps files as long as I set PYTHONHOME. I'll try that later.
>> What do you mean that your "python still has references to ~/gtk/inst"? Do you see rpaths with otool -L?
> I see them is I simply edit the file in vim.  They are not present in an 
> otool -L listing.
>> As for debugging, try I haven't experimented with it much, but at first glance it looks like adding "-m pdb" in the exec line of the launcher script is the easiest.
> Thanks.  Turns out my problems were caused by bad threading 
> implementation which when fixed made the problem go away.


For the record, pdb doesn't work with hung processes. You have to use gdb; instructions at

I'm still missing where you see the references to ~/gtk/inst. Are you opening the binary in vim and seeing the string amongst all of the binary?

John Ralls

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]