Bug#481480: python-gtk2: gtk.main() reads from stdin, so freezes GUI.

Francisco J. Rodríguez Bogado pacoqueen at gmail.com
Fri May 16 12:24:09 UTC 2008


Package: python-gtk2
Version: 2.12.1-2
Severity: important

gtk.main() seems to read from stdin somewhere in mainloop and freezes GUI when a python script that uses pygtk is run from terminal.

For instance, with this script:
$ cat test.py 
import pygtk
import gtk
v = gtk.Window()
caja = gtk.VBox()
caja.add(gtk.Label("Hola holita, vecinito."))
boton = gtk.Button(stock = gtk.STOCK_QUIT)
boton.connect("clicked", lambda *args, **kw: gtk.main_quit())
caja.add(boton)
v.add(caja)
v.show_all()
gtk.main()

$ python test.py 
 ... Doesn't even show the gtk.Window.

Tracing with strace:
$ strace python test.py 

[lot of lines omitted...]

futex(0x2b1c1d658460, 0x81 /* FUTEX_??? */, 2147483647) = 0
uname({sys="Linux", node="nostromo", ...}) = 0
poll([{fd=4, events=POLLIN}], 1, 0)     = 0
read(0, 
 ... and that's all.

If I try this:
$ python test.py </dev/null
All works fine.

If the same script is launched from Nautilus or gnome launch dialog
(Alt+F2) works fine too.


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to es_ES.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-gtk2 depends on:
ii  libatk1.0-0                   1.22.0-1   The ATK accessibility toolkit
ii  libc6                         2.7-11     GNU C Library: Shared libraries
ii  libcairo2                     1.6.4-2    The Cairo 2D vector graphics libra
ii  libglib2.0-0                  2.16.3-2   The GLib library of C routines
ii  libgtk2.0-0                   2.12.9-4   The GTK+ graphical user interface 
ii  libpango1.0-0                 1.20.2-2   Layout and rendering of internatio
ii  python                        2.5.2-1    An interactive high-level object-o
ii  python-cairo [python2.5-cairo 1.4.12-1   Python bindings for the Cairo vect
ii  python-gobject [python2.5-gob 2.14.1-4   Python bindings for the GObject li
ii  python-numeric [python2.5-num 24.2-8.2   Numerical (matrix-oriented) Mathem
ii  python-support                0.8.1      automated rebuilding support for P
pn  python2.4-cairo               <none>     (no description available)
pn  python2.4-gobject             <none>     (no description available)
pn  python2.4-numeric             <none>     (no description available)

python-gtk2 recommends no packages.

-- no debconf information






More information about the pkg-gnome-maintainers mailing list