jedi icon indicating copy to clipboard operation
jedi copied to clipboard

Refactoring.get_diff: 'file' does not start with 'path'

Open muffinmad opened this issue 3 years ago • 0 comments

Hi!

With (awesome) jedi 0.18.0:

$ python
Python 3.7.9 (default, Sep  9 2020, 00:09:07) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from jedi import Script, get_default_project
>>> project = get_default_project()
>>> script = Script(code='foo = 1', path='/some/file.py', project=project)
>>> script.rename(line=1, column=0, new_name='bar').get_diff()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mad/.virtualenvs/alstest/lib/python3.7/site-packages/jedi/api/refactoring/__init__.py", line 115, in get_diff
    return text + ''.join(f.get_diff() for f in self.get_changed_files().values())
  File "/Users/mad/.virtualenvs/alstest/lib/python3.7/site-packages/jedi/api/refactoring/__init__.py", line 115, in <genexpr>
    return text + ''.join(f.get_diff() for f in self.get_changed_files().values())
  File "/Users/mad/.virtualenvs/alstest/lib/python3.7/site-packages/jedi/api/refactoring/__init__.py", line 45, in get_diff
    from_p = self._from_path.relative_to(project_path)
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py", line 900, in relative_to
    .format(str(self), str(formatted)))
ValueError: '/some/file.py' does not start with '/Users/mad'

muffinmad avatar Mar 17 '21 21:03 muffinmad