[Eric] Why does Rope sometimes not find a definition?

OldGrantonian oldgrantonian at googlemail.com
Sat Nov 1 11:59:58 GMT 2008


Thanks for your very detailed explanation.

BTW: Because I'm not a programmer, I need a good IDE to browse around other
people's code. I learn faster that way. I'm simultaneously trying Komodo and
Wing, and comparing identical searches in the same python project. At the
moment, I'm only interested in the "browsing" functionality, such as finding
definitions, finding occurrences, and so on. Eric is vastly superior to the
other two IDEs. (And Komodo would charge £150 for the "Pro" version, which
is the only version that has object browsing.)

--------------------------------------------------------

>> On Fri, Oct 31, 2008 at 11:41 AM, Ali Gholami Rudi <aliqrudi at gmail.com>
wrote:

    In order to find out the return value of get_main_widget(), rope needs
    to know the object w holds.  Here, rope cannot infer the type of w;
    the reason might be the source code of qt.qApp.topLevelWidget() is
    unavailable (is this a c-extension module?)


Yes, topLevelWidget() is in C-code, which is in SIP files. So, it looks as
if the simple answer to my question is: Rope cannot find definitions if (a)
there is too much dynamic behavior, or (b) if the definitions are not
contained within a ".py" file. Is that true?

--------------------------------------------------------

I have some more questions. If you want me to split these questions into
separate posts, please let me know.

--------------------------------------------------------

If I cannot find a definition because of behaviour that I have just
discussed, it would still be useful to be able to do a "manual" query using
"Find Occurrences". It seems that "Find Occurrences" only works within
Python files. So I need to use an external text-search tool to find some
occurrences of "get_main_widget" (see above), because this occurs in SIP
files as well as PY files.

Maybe "Find Occurrences" could be based on a user-configurable option: "Do
you want to search in non-Python files?"

--------------------------------------------------------

If I use "Find Occurrences" to search for get_main_widget, there are 11
occurrences. (This agrees with my external text-search tool.)

However, if I use "Find Occurrences" to search for get_main_widget from
within the file where it is defined, I get the message: "No occurrences
found."

--------------------------------------------------------

I have never succeeded in getting "Find Implementations" to work. I
sometimes get the message: "Rope error: Not a method!", and sometimes: "Rope
error: String out of range.", and sometimes: "Rope error: Not a resolvable
Python identifier selected.", and sometimes: "Rope error: Cannot resolve the
identifier." (For a specific definition, the message is always the same.)

Here is what I do:

Highlight the name of the method in the following example:

def get_main_widget():

So I would highlight "get_main_widget"

Then Refactoring > Query > Find Implementations

--------------------------------------------------------

Before using any of the Rope searches, I need to highlight text. If the file
was never edited, this highlighting causes a random message to "save or
discard changes" before performing the search.

I say "random" because the message occurs before at least 50% of the
searches, but I cannot figure out in advance when the message will appear
and when it will not appear.

--------------------------------------------------------

Best regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/eric/attachments/20081101/f6ab3d78/attachment.html


More information about the Eric mailing list