spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.25k stars 1.6k forks source link

After renaming open file, attempting to save another file with the previous name results in error and poor Ux #6600

Open satej1210 opened 6 years ago

satej1210 commented 6 years ago

Problem Description

What steps will reproduce the problem?

Renamed file that was open (let's call it "A.py") in Finder to "B.py" and then tried saving a new file from Spyder with the same name ("A.py"). Then, Spyder gave warnings that the file "A.py" is not found and asks for me to close it. Then it got stuck in an infinite loop. But, in the end, the new file was saved as "untitled.py".

Traceback

  File "/Users/satejmhatre/anaconda3/envs/py27/lib/python2.7/site-packages/spyder/plugins/editor.py", line 2358, in run_file
    if editorstack.save():
  File "/Users/satejmhatre/anaconda3/envs/py27/lib/python2.7/site-packages/spyder/widgets/editor.py", line 1580, in save
    return self.save_as(index=index)
  File "/Users/satejmhatre/anaconda3/envs/py27/lib/python2.7/site-packages/spyder/widgets/editor.py", line 1716, in save_as
    if not self.close_file(ao_index):
  File "/Users/satejmhatre/anaconda3/envs/py27/lib/python2.7/site-packages/spyder/widgets/editor.py", line 1408, in close_file
    is_ok = force or self.save_if_changed(cancelable=True, index=index)
  File "/Users/satejmhatre/anaconda3/envs/py27/lib/python2.7/site-packages/spyder/widgets/editor.py", line 1521, in save_if_changed
    finfo = self.data[index]
IndexError: list index out of range

Package Versions

Dependencies

pyflakes >=0.5.0  :  1.6.0 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pygments >=2.0    :  2.2.0 (OK)
pandas >=0.13.1   :  None (NOK)
numpy >=1.7       :  None (NOK)
sphinx >=0.6.6    :  1.7.1 (OK)
rope >=0.9.4      :  0.10.7 (OK)
jedi >=0.9.0      :  0.11.1 (OK)
psutil >=0.3      :  5.4.3 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
sympy >=0.7.3     :  None (NOK)
cython >=0.21     :  None (NOK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0;<6.0:  5.4.1 (OK)
pylint >=0.25     :  1.8.2 (OK)
ccordoba12 commented 6 years ago

Thanks for reporting. We'll fix this in a future release.

Khalilsqu commented 5 years ago

I am using windows 10, I believe I cannot reproduce this issue.