Spyder: Failure checking out a branch and the opened file is in a different path

Created on 22 Jun 2018  路  9Comments  路  Source: spyder-ide/spyder

This happened:

  1. I had a file opened in Spyder
  2. I git-checked out another branch with that file placed in a different path
  3. Spyder told me to close the tab since the file couldn't be found
  4. Spyder raised an internal problem

TRACE:
self.refresh_plugin() # To give focus to the plugin's widget
File "/Users/manuel/anaconda/envs/sentisis3/lib/python3.6/site-packages/spyder/plugins/explorer.py", line 94, in refresh_plugin
self.treewidget.update_history(new_path)
File "/Users/manuel/anaconda/envs/sentisis3/lib/python3.6/site-packages/spyder/widgets/explorer.py", line 1124, in update_history
directory = osp.abspath(to_text_string(directory))
File "/Users/manuel/anaconda/envs/sentisis3/lib/python3.6/posixpath.py", line 374, in abspath
cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

File Explorer Reproduced Bug

All 9 comments

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

@ccordoba12 Is this because what was previously the working directory doesn't exist on the other branch, and we just need to check for that?

Yes, I think so.

I can get the same error message without version control using the following steps:

  1. Make a new directory
  2. Change the Spyder working directory to this directory
  3. Delete the directory outside Spyder
  4. Click on the File Explorer tab to bring it on top (if it is already on top, then first click on another tab and then click on the File Explorer tab).

Ok, thanks a lot @jitseniesen!

@dalthviz, please work on this one.

Just to give here more info about the issue, I can't replicate it in Windows since when you try to delete the folder a dialog says it's open by another program.

imagen

However using Ubuntu (and probably in other linux distros), deleting permanently the directory (holding shift + supr or using rm -rf) the error shows up.

imagen

@dalthviz You can't just do rm -rf in msys2 (Git-bash) or Cygwin?

Good catch @CAM-Gerlach that was something I didn't test. Although testing it, at least with Git-bash,it doesn't let you delete the directory:

imagen

Okay, thanks. Must ultimately be limited by the Win32 APIs MSYS2 is calling.

Was this page helpful?
0 / 5 - 0 ratings