| Last change
                  on this file since 1739 was
                  1726,
                  checked in by ezyang, 15 years ago | 
        
          | Scriptsify ipython, add patch for GTK. | 
        | File size:
            786 bytes | 
      
      
        
  | Rev | Line |  | 
|---|
| [1726] | 1 | diff --git a/IPython/Shell.py b/IPython/Shell.py | 
|---|
|  | 2 | index 9481099..38006d7 100644 | 
|---|
|  | 3 | --- a/IPython/Shell.py | 
|---|
|  | 4 | +++ b/IPython/Shell.py | 
|---|
|  | 5 | @@ -1152,7 +1152,8 @@ class IPShellMatplotlibQt4(IPShellQt4): | 
|---|
|  | 6 | def check_gtk(mode): | 
|---|
|  | 7 | try: | 
|---|
|  | 8 | import gtk | 
|---|
|  | 9 | -    except ImportError: | 
|---|
|  | 10 | +    except (ImportError, RuntimeError): | 
|---|
|  | 11 | +        # GTK not present, or can't be started (no X11, happens in console) | 
|---|
|  | 12 | return mode | 
|---|
|  | 13 | if hasattr(gtk,'set_interactive'): | 
|---|
|  | 14 | gtk.set_interactive(False) | 
|---|
|  | 15 | @@ -1243,7 +1244,8 @@ def _select_shell(argv): | 
|---|
|  | 16 | th_mode = 'tkthread' | 
|---|
|  | 17 |  | 
|---|
|  | 18 | # New versions of pygtk don't need the brittle threaded support. | 
|---|
|  | 19 | -        th_mode = check_gtk(th_mode) | 
|---|
|  | 20 | +        if th_mode == 'gthread': | 
|---|
|  | 21 | +            th_mode = check_gtk(th_mode) | 
|---|
|  | 22 | return th_shell[th_mode] | 
|---|
|  | 23 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.