RefactoringRope/RefactoringClient.py

changeset 251
4dcc73076100
parent 245
75a35a927952
child 293
dd1c7ed6d880
--- a/RefactoringRope/RefactoringClient.py	Mon Apr 02 17:36:41 2018 +0200
+++ b/RefactoringRope/RefactoringClient.py	Mon Apr 02 17:43:09 2018 +0200
@@ -12,15 +12,12 @@
 import sys
 import os
 
+try:
+    str = unicode   # __IGNORE_WARNING__ __IGNORE_EXCEPTION__
+except NameError:
+    pass
+
 sys.path.insert(0, os.path.dirname(__file__))
-if sys.version_info[0] >= 3:
-    # TODO: unify this
-##    rope_path = os.path.join(os.path.dirname(__file__), 'rope_py3')
-    rope_path = os.path.join(os.path.dirname(__file__), 'rope_py2')
-else:
-    rope_path = os.path.join(os.path.dirname(__file__), 'rope_py2')
-    str = unicode   # __IGNORE_WARNING__
-sys.path.insert(0, rope_path)
 
 import rope
 import rope.base.project
@@ -114,10 +111,6 @@
         @param params dictionary with method specific parameters
         @type dict
         """
-##        if "filename" in params and sys.version_info[0] == 2:
-##            params["filename"] = params["filename"].encode(
-##                sys.getfilesystemencoding())
-        
         self.__methodMapping[method](params)
     
     def __handleRopeError(self, err):
@@ -129,11 +122,14 @@
         @return dictionary containing the error information
         @rtype dict
         """
+        import traceback
+        tb = traceback.format_tb(sys.exc_info()[2])
         ropeError = str(type(err)).split()[-1]
         ropeError = ropeError[1:-2].split('.')[-1]
         errorDict = {
             "Error": ropeError,
             "ErrorString": str(err),
+            "Traceback": tb,
         }
         if ropeError == 'ModuleSyntaxError':
             errorDict["ErrorFile"] = err.filename
@@ -185,7 +181,7 @@
             "RopeFolderName": self.__project.ropefolder.real_path,
             "DefaultConfig": self.__project._default_config(),
             "RopeHelpFile": os.path.join(
-                rope_path, "rope", "docs", "overview.rst"),
+                os.path.dirname(__file__), "rope", "docs", "overview.rst"),
             "RopeInfo": rope.INFO,
             "RopeVersion": rope.VERSION,
             "RopeCopyright": rope.COPYRIGHT,

eric ide

mercurial