/Users/gtk-osx/gtk/inst/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:40: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
from gtk import _gtk
ImportError: could not import pango
ImportError: could not import pango
(process:20928): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
Oct 22 11:12:14 Shriharis-MacBook-Air.local python[20928] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
ImportError: cannot import name MenuShell from gtk
Fatal Python error: can't initialize module gtk_osxapplication:
Abort trap: 6
Yeah, it's a libtool weirdness in the pygtk tarball that interacts badly with something in the 10.7 linker. It got hashed through last week in the forum [1].
On Oct 21, 2011, at 12:04 PM, Shrihari Sankaran wrote:
> Hello,
>
> I'm trying to build and bundle a PyGTK application on my Lion.
>
> What I've done so far:
> • Created a new user called "gtk-ox" and signed into the terminal as that user.
> • Downloaded the shell script
> • sh gtk-osx-build-setup.sh
> • alias jhbuild="PATH=~/.local/bin:$PATH jhbuild"
> • jhbuild bootstrap
> • jhbuild build meta-gtk-osx-bootstrap
> • jhbuild build meta-gtk-osx-core
> All these went fine. Then I performed:
> • jhbuild build meta-gtk-osx-python
> At this point, it skipped the first 12 steps. I got this: http://pastebin.com/XrQShjFu
>
> I went ahead and open the shell.
> • jhbuild shell
> • cd myapp
> • python my_app.py
> Now, I'm getting this error:
>
> Traceback (most recent call last):
> File "my_app.py", line 12, in <module>
> import gtk
> File "/Users/gtk-osx/gtk/inst/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 40, in <module>
> from gtk import _gtk
> ImportError: dynamic module does not define init function (init_gtk)
>
> Any idea what's wrong here?
Try this:
Edit pygtk-2.24.0/gtk/Makefile to replace "-export-symbols-regex" with "-export_symbol", delete .../gtk/.libs/_gtk.*, and rerun build.
Regards,
John Ralls
[1] https://sourceforge.net/apps/phpbb/gtk-osx/viewtopic.php?f=3&t=72