python-rope / ropevim

vim mode that uses rope library to provide features like python refactorings and code-assists
GNU General Public License v2.0
245 stars 34 forks source link

Crash on RopeGotoDefinition #80

Closed mcepl closed 1 year ago

mcepl commented 4 years ago
Chyba při zpracování function RopeGotoDefinition[1]..provider#python3#Call:
řádek   18:
Error invoking 'python_execute' on channel 3 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/matej/.local/lib/python3.7/site-packages/ropemode/decorators.py", line 54, in newfunc
    return func(*args, **kwds)
  File "/home/matej/.local/lib/python3.7/site-packages/ropemode/interface.py", line 152, in goto_definition
    self._goto_location(definition[0], definition[1])
  File "/home/matej/.local/lib/python3.7/site-packages/ropemode/interface.py", line 435, in _goto_location
    other=self.env.get('goto_def_newwin'))
  File "/home/matej/.local/lib/python3.7/site-packages/ropevim.py", line 248, in find_file
    if self._samefile(win.buffer.name, filename):
  File "/home/matej/.local/lib/python3.7/site-packages/ropevim.py", line 222, in _samefile
    return os.path.samefile(file1, file2)
  File "/usr/lib64/python3.7/genericpath.py", line 96, in samefile
    s1 = os.stat(f1)
FileNotFoundError: [Errno 2] No such file or directory: ''
benrudolph commented 3 years ago

i also hit this intermittently

eivindjahren commented 1 year ago

This might have been solved by #94 , I am testing this now. Essentially forcing a vim.tabpages[i].windows[j].buffer.name = '' (ie. a buffer without a named file to it) and checking that _samefile now correctly handles empty filenames.

eivindjahren commented 1 year ago

@lieryan, unless something completely weird is happening, I can confirm that this was fixed in #94. You can see the successful test here: https://github.com/python-rope/ropevim/pull/96/files#diff-23a7fa2ce62ec62b0ced838a5baa577583b31efc26e6e950af8e817cad348124 . I have readied #96, hopefully it will help close some other issues as well :smile:

lieryan commented 1 year ago

Thanks for testing this issue @eivindjahren.