mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-30 06:25:28 -04:00
switch .is_dir and .exists for os.access to avoid PermissionError on startup
This commit is contained in:
parent
c3dd0f22e5
commit
de2ab43f7f
22 changed files with 119 additions and 97 deletions
archivebox
|
@ -478,7 +478,7 @@ def log_list_finished(links):
|
|||
def log_removal_started(links: List["Link"], yes: bool, delete: bool):
|
||||
print(f'[yellow3][i] Found {len(links)} matching URLs to remove.[/]')
|
||||
if delete:
|
||||
file_counts = [link.num_outputs for link in links if Path(link.link_dir).exists()]
|
||||
file_counts = [link.num_outputs for link in links if os.access(link.link_dir, os.R_OK)]
|
||||
print(
|
||||
f' {len(links)} Links will be de-listed from the main index, and their archived content folders will be deleted from disk.\n'
|
||||
f' ({len(file_counts)} data folders with {sum(file_counts)} archived files will be deleted!)'
|
||||
|
@ -572,7 +572,7 @@ def printable_folder_status(name: str, folder: Dict) -> str:
|
|||
|
||||
|
||||
if folder['path']:
|
||||
if Path(folder['path']).exists():
|
||||
if os.access(folder['path'], os.R_OK):
|
||||
num_files = (
|
||||
f'{len(os.listdir(folder["path"]))} files'
|
||||
if Path(folder['path']).is_dir() else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue