Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File list for WSL2-mapped drive doesn't update automatically #18073

Open
fohria opened this issue May 30, 2022 · 8 comments
Open

File list for WSL2-mapped drive doesn't update automatically #18073

fohria opened this issue May 30, 2022 · 8 comments

Comments

@fohria
Copy link

fohria commented May 30, 2022

I have Spyder standalone install on Windows 10 and connect to Spyder kernels running in WSL2 (Ubuntu 20.04) on the same machine.

I've also mapped my WSL2 drive to W:\ on windows, so I can easily navigate the files through Spyder etc.

When creating/deleting/renaming files on the WSL2 drive in the Spyder Files pane, the file list is not automatically updated. I have to go into at least two subfolders down/up and then back for the changes to show.

Files update nicely if I create/delete/rename on the Windows c: drive.

This is likely a very niche use-case, so I don't expect you to prioritise this annoyance, but would make me happy if it was fixed :)

(and perhaps this is not Spyder's fault, but WSL/windows, and there's nothing to be done really?)

Versions

  • Spyder version: 5.3.1 (but issue has existed in previous versions as well)
  • Python version: 3.8.10
  • Qt version: 5.15.2
  • PyQt version: 5.15.6
  • Operating System name/version: Win10 H21
@dalthviz
Copy link
Member

dalthviz commented Jun 1, 2022

Hi @fohria thank you for the feedback! That's quite an usability issue, maybe another workaround for the moment could be to activated/deactivate the filter (imagen) to trigger an update? Not totally sure if this is something related with Qt/PyQt but if you find out more info about this let us know!

@fohria
Copy link
Author

fohria commented Jun 2, 2022

activated/deactivate the filter (imagen) to trigger an update?

Didn't help unfortunately

Not totally sure if this is something related with Qt/PyQt but if you find out more info about this let us know!

Any suggestions on how/what to troubleshoot? I can give it a go whenever I find the time

@dalthviz
Copy link
Member

dalthviz commented Jun 2, 2022

Checking a little bit I found this: https://forum.qt.io/topic/116586/qfilesystemmodel-update-problem-for-shared-network-location so seems like this is kind of a limitation of the widget model we are using to fetch the file system (QFileSystemModel).

As a side note, and as suggested in the answer from the link above, maybe Spyder will need to use a QFileSystemWatcher (detecting if the current path is from a mapped network drive) to keep up with the changes and if that doesn't work then we will need to somehow add a way to trigger a refresh (most probably manually with a button when Spyder detects that a network directory is the current one).

Just in case, @fohria could you check if running this from the Internal console (you can make it visible checking it at View > Panes > Internal console) triggers the refresh when checking the mapped drive:

spy.window.explorer.refresh(force_current=True)

Let us know!

@fohria
Copy link
Author

fohria commented Jun 3, 2022

Checking a little bit I found this: https://forum.qt.io/topic/116586/qfilesystemmodel-update-problem-for-shared-network-location so seems like this is kind of a limitation of the widget model we are using to fetch the file system (QFileSystemModel).

Oh, it's because it's technically a network drive, interesting

Just in case, @fohria could you check if running this from the Internal console (you can make it visible checking it at View > Panes > Internal console) triggers the refresh when checking the mapped drive:

spy.window.explorer.refresh(force_current=True)

No effect I'm afraid :(

Since the file list updates when I double click into a subfolder, and then click the up arrow "parent" on top of file list pane, perhaps there's a clue there what it is that triggers a refresh?

@dalthviz
Copy link
Member

dalthviz commented Jun 3, 2022

I think then the update is done since the current directory is changing 🤔

Could you try from the internal console the following:

spy.window.explorer.chdir(None)

Let us know!

@fohria
Copy link
Author

fohria commented Jun 4, 2022

spy.window.explorer.chdir(None)

Does nothing, even a few times in a row. Same with spy.window.explorer.chdir(".").

What does work, is spy.window.explorer.chdir(".."), the change appears. But I'm now of course in the parent folder and have to navigate back (or use the internal console to go back, i.e. spy.window.explorer.chdir("workfolder")).

I tried spy.window.explorer.chdir("subfolder") but not sure if the list is immediately updated, as I'm then inside that subfolder and have to navigate back to see the contents in the main folder.

Also tried creating a file subfolder/hello.py (file ending doesn't matter, tried that too), then spy.window.explorer.chdir("subfolder"), but the file doesn't show, until I call spy.window.explorer.chdir("..").

Just to be clear, above examples are based on some folder structure like parentfolder/workfolder/subfolder

I'm not sure but it seems like spy.window.explorer.chdir("..") is the magic command that actually forces the content refresh?

@dalthviz
Copy link
Member

dalthviz commented Jun 6, 2022

Thanks for testing @fohria ! I guess with mapped drives yes the way to force polling is to change the directory to a parent folder as you say. Maybe this could be related with some info regarding caching from the Qt docs: https://doc.qt.io/qt-6/qfilesystemmodel.html#caching-and-performance

@dalthviz
Copy link
Member

dalthviz commented Jun 6, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants