[gedit-plugins/wip/python3: 10/19] More informative error when failing to load module



commit ad2734b6c43d5fd66a519a121f257bad652b08b5
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Fri Nov 9 11:10:25 2012 +0100

    More informative error when failing to load module

 plugins/commander/commander/commands/__init__.py |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/plugins/commander/commander/commands/__init__.py b/plugins/commander/commander/commands/__init__.py
index 8e6f1b8..8bd76dc 100644
--- a/plugins/commander/commander/commands/__init__.py
+++ b/plugins/commander/commander/commands/__init__.py
@@ -21,12 +21,8 @@
 
 import os
 from gi.repository import GLib, GObject, Gio
-import sys
-import bisect
-import types
-import shlex
-import re
-import os
+
+import sys, bisect, types, shlex, re, os, traceback
 
 import commands.module as module
 import commands.method as method
@@ -407,7 +403,8 @@ class Commands(Singleton):
             mod.reload()
         except Exception as e:
             # Reload failed, we remove the module
-            print('Failed to reload module (%s):' % (mod.name,), e)
+            info = traceback.format_tb(sys.exc_info()[2])
+            print('Failed to reload module ({0}):\n  {1}'.format(mod.name, info[-1]))
 
             self._modules.remove(mod)
             return



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]