Skip to content

Windows?: rmdir call fails even when directory is empty (or becomes empty afterwards) #61

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

Closed
drojf opened this issue May 26, 2019 · 1 comment

Comments

@drojf
Copy link
Collaborator

drojf commented May 26, 2019

We had a user with this error:

07th Mod - Install failed due to error: [WinError 145] Das Verzeichnis ist nicht leer: 'Tatarigoroshi Ch.3 Extraction\\HigurashiEp03_Data\\Plugins'

Traceback (most recent call last):
  File "C:\Users\[USERNAME]\Desktop\installer\higu_win_installer_32\install_data\python\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\Users\[USERNAME]\Desktop\installer\higu_win_installer_32\install_data\python\lib\threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\[USERNAME]\Desktop\installer\higu_win_installer_32\install_data\httpGUI.py", line 388, in errorPrintingInstaller
    installerFunction(args)
  File "C:\Users\[USERNAME]\Desktop\installer\higu_win_installer_32\install_data\higurashiInstaller.py", line 210, in main
    installer.moveFilesIntoPlace()
  File "C:\Users\[USERNAME]\Desktop\installer\higu_win_installer_32\install_data\higurashiInstaller.py", line 129, in moveFilesIntoPlace
    toDir = self.dataDirectory
  File "C:\Users\[USERNAME]\Desktop\installer\higu_win_installer_32\install_data\higurashiInstaller.py", line 155, in _moveDirectoryIntoPlace
    self._moveDirectoryIntoPlace(fromDir=src, toDir=target)
  File "C:\Users\[USERNAME]\Desktop\installer\higu_win_installer_32\install_data\higurashiInstaller.py", line 160, in _moveDirectoryIntoPlace
    os.rmdir(fromDir)

The error was on the os.rmdir(fromDir). However, when the user went to check that directory, it was empty.

We may need to add a retry (with delay) for the moveFilesIntoPlace function, and also change the single os.rmdir(fromDir) function to the forceRmTree I added in the other day, if that is safe to do. The forceRmTree function will still fail.

I understand that it was implemented this way to have the shortest time where files are in a 'bad' state. On umineko we just extract the files directly to the game folder so we don't have this issue.

Another alternative would be to only on windows, call a windows command to do the file move. I suspect this is a windows only problem.

May also want to see this issue, where it mentions that simply having the folder open, or having some antivirus scan the folder, can cause the removal to fail: pypa/pip#306

Update

Assuming the removal of moveDirectoryIntoPlacec on Windows goes through smoothly, this isssue should be closed. Was committed in: e80431f

@drojf drojf changed the title rmdir call fails even when directory is empty (or becomes empty afterwards) Windows?: rmdir call fails even when directory is empty (or becomes empty afterwards) May 28, 2019
@drojf
Copy link
Collaborator Author

drojf commented Jun 15, 2019

Should be closed in the latest installer.

@drojf drojf closed this as completed Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant