try: import pygtk pygtk.require('2.0') except ImportError: pass