You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "tribler\gui\utilities.py", line 438, in trackback_wrapper
File "tribler\gui\utilities.py", line 435, in trackback_wrapper
File "tribler\gui\widgets\settingspage.py", line 230, in initialize_with_settings
File "tribler\gui\widgets\settingspage.py", line 256, in load_settings_data_tab
File "tribler\gui\widgets\settingspage.py", line 261, in refresh_current_version_checkbox
File "tribler\gui\widgets\settingspage.py", line 275, in refresh_version_checkboxes
File "tribler\gui\widgets\settingspage.py", line 250, in _version_dir_checkbox
File "tribler\core\utilities\path_util.py", line 59, in size
File "tribler\core\utilities\path_util.py", line 59, in <genexpr>
File "genericpath.py", line 50, in getsize
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\tribler\\AppData\\Roaming\\.Tribler\\7.13\\sqlite\\knowledge.db-journal'
It looks like we have a raise condition in Path.size():
defsize(self, include_dir_sizes: bool=True) ->int:
""" Return the size of this file or directory (recursively). Args: include_dir_sizes: If True, return the size of files and directories, not the size of files only. Returns: The size of this file or directory. """ifnotself.exists():
return0ifself.is_file():
returnself.stat().st_sizesize=os.path.getsize(self.absolute()) ifinclude_dir_sizeselse0# get root dir sizeforroot, dir_names, file_namesinos.walk(self):
names=itertools.chain(dir_names, file_names) ifinclude_dir_sizeselsefile_namespaths= (os.path.join(root, name) fornameinnames)
size+=sum(os.path.getsize(p) forpinpathsifos.path.exists(p)) # <-- the error is happened herereturnsize
The function checks that the file exists and immediately asks for its size. But it may be possible that the file was deleted right after the exists call. To handle this, we need to add a try/except block that catches FileNotFoundError.
The text was updated successfully, but these errors were encountered:
The issue was caught by the Application Tester:
It looks like we have a raise condition in
Path.size()
:The function checks that the file exists and immediately asks for its size. But it may be possible that the file was deleted right after the
exists
call. To handle this, we need to add atry/except
block that catchesFileNotFoundError
.The text was updated successfully, but these errors were encountered: