rope icon indicating copy to clipboard operation
rope copied to clipboard

Python error while aborting the open project prompt

Open mcepl opened this issue 10 years ago • 3 comments

Misreported by an anonymous party in the tracker for Bitbucket itself: http://bitbucket.org/jespern/bitbucket/issue/571/python-error-while-aborting-the-open-project

mcepl avatar Nov 30 '13 23:11 mcepl

Hi,

I'm including a patch. It merely prints what's wrong. But I have not tested this patch; does it work for you?

https://gist.github.com/7761135 https://gist.github.com/7761136

By the way, would you use the mailing list for future bug reports; It's too hard for me to work with browsers ;-)

Thanks, Ali

diff --git a/ropemode/interface.py b/ropemode/interface.py
--- a/ropemode/interface.py
+++ b/ropemode/interface.py
@@ -1,11 +1,14 @@
 import os

 import rope.base.change
-from rope.base import libutils, utils
+from rope.base import libutils, utils, exceptions
 from rope.contrib import codeassist, generate, autoimport, findit

 from ropemode import refactor, decorators, dialog

+
+class RopemodeError(exceptions.RopeError):
-    pass
  
  class RopeMode(object):

@@ -82,6 +85,8 @@
     def open_project(self, root=None):
         if not root:
             root = self.env.ask_directory('Rope project root folder: ')
-        if root is None:
-            raise RopemodeError("No project root specified")
       if self.project is not None:
           self.close_project()
       progress = self.env.create_progress('Opening [%s] project' % root)

mcepl avatar Nov 30 '13 23:11 mcepl

Including the patch as an attachment...

mcepl avatar Nov 30 '13 23:11 mcepl

Now it raises the added Python error. I think its better than the vim error but not really userfriendly. Is there a simple way to catch all RopeErrors and just print the message to the command line instead of providing the whole traceback?

Traceback (most recent call last):
  File "/home/phxx/.vim/custom/rope/pylibs/ropemode/decorators.py", line 53, in newfunc
    return func(_args, *_kwds)
  File "/home/phxx/.vim/custom/rope/pylibs/ropemode/interface.py", line 89, in open_project
    raise RopemodeError("No project root specified")
RopemodeError: No project root specified

mcepl avatar Nov 30 '13 23:11 mcepl

Closing. Not quite sure what this was about, but likely severely outdated as this was a ropemode issue.

lieryan avatar Nov 30 '22 11:11 lieryan