Closed Jimver closed 3 years ago
I've actually seen this error myself. This is caused by a race condition in the files.delete_folder
function. This could be one of two causes:
shutil.rmtree
as outlined in this issue: https://bugs.python.org/issue29699if os.path.isdir(folder)
checks if the folder exists before deleting it, but it no longer exists by the time shutil.rmtree
tries to delete it, as described more here: https://github.com/mopidy/mopidy/issues/1766Now, the easy solution is to just set ignore_errors=True
, but I still want some errors being raised so I can attempt to fix directory permissions: https://blog.nathanv.me/posts/python-permission-issue/
Anyways, I think I've developed a fix, but I have not gotten a chance yet to fully test it and push it to a release.
I was unable to get the issue to occur on my machine to test my fix, but I think it should work. I've pushed version 0.5.2 which incorporates this. I'm going to close the issue for now, but if it comes up still, please just re-open it.
I still get the issue unfortunately this is in v0.5.3, btw I cannot reopen the issue it seems:
2020-11-15 15:21:12.241 | DEBUG | lib.flight_sim:install_mod_archive:521 - Installing mod C:/Users/Jim/Downloads/Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL.zip
2020-11-15 15:21:12.241 | DEBUG | lib.files:hash_file:349 - Hashing C:/Users/Jim/Downloads/Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL.zip
2020-11-15 15:21:12.243 | DEBUG | lib.files:read_hash:374 - No hash found
2020-11-15 15:21:12.244 | DEBUG | lib.flight_sim:extract_mod_archive:451 - Hash mismatch, extracting
2020-11-15 15:21:12.244 | DEBUG | lib.files:delete_folder:151 - Attempting to delete folder C:\Users\Jim\AppData\Local\Temp\MSFS Mod Manager
2020-11-15 15:21:12.246 | DEBUG | lib.files:create_tmp_folder:254 - Creating temp folder C:\Users\Jim\AppData\Local\Temp\MSFS Mod Manager
2020-11-15 15:21:12.246 | DEBUG | lib.files:extract_archive:297 - Extracting archive C:/Users/Jim/Downloads/Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL.zip to C:\Users\Jim\AppData\Local\Temp\MSFS Mod Manager\Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL
2020-11-15 15:21:12.498 | DEBUG | lib.flight_sim:install_mods:493 - Installing mod C:\Users\Jim\AppData\Local\Temp\MSFS Mod Manager\Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL
2020-11-15 15:21:12.498 | DEBUG | lib.flight_sim:determine_mod_folders:467 - Locating mod folders inside C:\Users\Jim\AppData\Local\Temp\MSFS Mod Manager\Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL
2020-11-15 15:21:12.501 | DEBUG | lib.flight_sim:determine_mod_folders:482 - Mod found C:\Users\Jim\AppData\Local\Temp\MSFS Mod Manager\Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL\Asobo_208B_GRAND_CARAVAN_EX_UN
2020-11-15 15:21:12.505 | DEBUG | lib.files:copy_folder:179 - Copying folder C:\Users\Jim\AppData\Local\Temp\MSFS Mod Manager\Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL\Asobo_208B_GRAND_CARAVAN_EX_UN to C:\Users\Jim\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community\Asobo_208B_GRAND_CARAVAN_EX_UN
2020-11-15 15:21:12.508 | DEBUG | lib.files:delete_folder:147 - Folder C:\Users\Jim\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community\Asobo_208B_GRAND_CARAVAN_EX_UN does not exist
2020-11-15 15:21:12.662 | DEBUG | lib.thread:run:28 - Thread completed
2020-11-15 15:21:12.663 | ERROR | widgets.main_widget:base_fail:209 - Failed to install mod archive
2020-11-15 15:21:12.663 | ERROR | widgets.main_widget:base_fail:210 - <class 'shutil.Error'>: [('C:\\Users\\Jim\\AppData\\Local\\Temp\\MSFS Mod Manager\\Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL\\Asobo_208B_GRAND_CARAVAN_EX_UN\\SimObjects\\Airplanes\\Asobo_208B_GRAND_CARAVAN_EX-UN\\TEXTURE.UN\\CESSNA_208B_GRANDCARAVANEX_AIRFRAME_DECAL_ALBD.PNG.DDS.FLAGS', 'C:\\Users\\Jim\\AppData\\Local\\Packages\\Microsoft.FlightSimulator_8wekyb3d8bbwe\\LocalCache\\Packages\\Community\\Asobo_208B_GRAND_CARAVAN_EX_UN\\SimObjects\\Airplanes\\Asobo_208B_GRAND_CARAVAN_EX-UN\\TEXTURE.UN\\CESSNA_208B_GRANDCARAVANEX_AIRFRAME_DECAL_ALBD.PNG.DDS.FLAGS', "[Errno 2] No such file or directory: 'C:\\\\Users\\\\Jim\\\\AppData\\\\Local\\\\Packages\\\\Microsoft.FlightSimulator_8wekyb3d8bbwe\\\\LocalCache\\\\Packages\\\\Community\\\\Asobo_208B_GRAND_CARAVAN_EX_UN\\\\SimObjects\\\\Airplanes\\\\Asobo_208B_GRAND_CARAVAN_EX-UN\\\\TEXTURE.UN\\\\CESSNA_208B_GRANDCARAVANEX_AIRFRAME_DECAL_ALBD.PNG.DDS.FLAGS'"), ('C:\\Users\\Jim\\AppData\\Local\\Temp\\MSFS Mod Manager\\Asobo_208B_GRAND_CARAVAN_EX_UN_YtQmL\\Asobo_208B_GRAND_CARAVAN_EX_UN\\SimObjects\\Airplanes\\Asobo_208B_GRAND_CARAVAN_EX-UN\\TEXTURE.UN\\CESSNA_208B_GRANDCARAVANEX_AIRFRAME_LIVERY_ALBD.PNG.DDS.json', 'C:\\Users\\Jim\\AppData\\Local\\Packages\\Microsoft.FlightSimulator_8wekyb3d8bbwe\\LocalCache\\Packages\\Community\\Asobo_208B_GRAND_CARAVAN_EX_UN\\SimObjects\\Airplanes\\Asobo_208B_GRAND_CARAVAN_EX-UN\\TEXTURE.UN\\CESSNA_208B_GRANDCARAVANEX_AIRFRAME_LIVERY_ALBD.PNG.DDS.json', "[Errno 2] No such file or directory: 'C:\\\\Users\\\\Jim\\\\AppData\\\\Local\\\\Packages\\\\Microsoft.FlightSimulator_8wekyb3d8bbwe\\\\LocalCache\\\\Packages\\\\Community\\\\Asobo_208B_GRAND_CARAVAN_EX_UN\\\\SimObjects\\\\Airplanes\\\\Asobo_208B_GRAND_CARAVAN_EX-UN\\\\TEXTURE.UN\\\\CESSNA_208B_GRANDCARAVANEX_AIRFRAME_LIVERY_ALBD.PNG.DDS.json'")]
Just wanted to say, haven't forgotten about this issue. I just graduated from college and am finishing up moving. Hopefully I'll be able to address this next week.
Note for myself: This issue only occurs when compiled with PyInstaller, not when running on the interpreter directly. I think this may have to do with the path of the file being deleted being too long for DOS (260 characters).
I know I've said this before, but I think I finally figured it out and fixed it.
I'm fairly certain now that it wasn't some sort of race condition, but in fact that the Windows path to the file was too long (old-school DOS legacy stuff imposes a limit of something like 260 characters), causing the cryptic FileNotFoundError
even though the file existed (especially with the Liveries Megapack stuff with some huge filenames) I think I've fixed it by prepending \\?\
to all file copy/move/delete operations. See this for more info: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#win32-file-namespaces
What also made this difficult to track down, is that it doesn't happen when I run the application locally with my installed Python interpreter, only when run after being packaged with PyInstaller.
Should be fixed for real in f904414 and Version 0.5.5. Feel free to re-open if it recoccurs.
Hello, upon installing the following livery from flightsim.to: https://flightsim.to/file/3209/united-nations-cessna-208-b I get an error upon installation (see image below, could not copy the text unfortunately).
It's quite strange as the
layout.json
seems fine to me.Expected Behavior
Mod installs successfully without errors
Actual Behavior
Error given on install:![afbeelding](https://user-images.githubusercontent.com/7677699/99073129-a0157080-25b5-11eb-8b74-1adef9deb1c8.png)
Steps to Reproduce the Problem
Specifications
v0.5.1
Debug Log Contents (only if reporting a bug)
This file is found at
%APPDATA%\MSFS Mod Manager\debug.log
(Everything after the last
__main__:<module>:27 - -----------------------
line)