Workaround to suppress gtk bogus warning regarding non-string items in sys.argv, error reported upstream as gnome (pygtk) #637877

svn: r16313
This commit is contained in:
Doug Blank 2010-12-25 16:55:28 +00:00
parent 320cbb0308
commit 87873dbf22

View File

@ -33,6 +33,7 @@ perform a translation on import, eg gtk.
#
#------------------------------------------------------------------------
import platform
import sys
#-------------------------------------------------------------------------
#
@ -100,12 +101,17 @@ def has_display():
Tests to see if Python is currently running with gtk and
windowing system is Mac OS-X's "quartz".
"""
# FIXME: currently, gtk.init_check() requires all strings
# in argv, and we might have unicode.
temp, sys.argv = sys.argv, sys.argv[:1]
try:
import gtk
except:
return False
try:
gtk.init_check()
sys.argv = temp
return True
except:
sys.argv = temp
return False