Replace deprecated rmtree argument

main
Bob Mottram 2024-07-04 12:08:20 +01:00
parent f6e245da08
commit ce4bab05b7
4 changed files with 6 additions and 6 deletions

View File

@ -700,7 +700,7 @@ def archive_media(base_dir: str, archive_directory: str,
else:
# archive to /dev/null
rmtree(os.path.join(base_dir + '/media', week_dir),
ignore_errors=False, onerror=None)
ignore_errors=False, onexc=None)
break

View File

@ -483,7 +483,7 @@ def _create_news_mirror(base_dir: str, domain: str,
mirror_article_dir = mirror_dir + '/' + post_id
if os.path.isdir(mirror_article_dir):
rmtree(mirror_article_dir,
ignore_errors=False, onerror=None)
ignore_errors=False, onexc=None)
removals.append(post_id)
no_of_dirs -= 1

View File

@ -976,7 +976,7 @@ def delete_all_posts(base_dir: str,
if os.path.isfile(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path, ignore_errors=False, onerror=None)
shutil.rmtree(file_path, ignore_errors=False, onexc=None)
except OSError as ex:
print('ERROR: delete_all_posts ' + str(ex))

View File

@ -36,7 +36,7 @@ def import_theme(base_dir: str, filename: str) -> bool:
return False
temp_theme_dir = base_dir + '/imports/files'
if os.path.isdir(temp_theme_dir):
rmtree(temp_theme_dir, ignore_errors=False, onerror=None)
rmtree(temp_theme_dir, ignore_errors=False, onexc=None)
os.mkdir(temp_theme_dir)
unpack_archive(filename, temp_theme_dir, 'zip')
essential_theme_files = ('name.txt', 'theme.json')
@ -80,9 +80,9 @@ def import_theme(base_dir: str, filename: str) -> bool:
os.mkdir(theme_dir)
copytree(temp_theme_dir, theme_dir, False, None)
if os.path.isdir(temp_theme_dir):
rmtree(temp_theme_dir, ignore_errors=False, onerror=None)
rmtree(temp_theme_dir, ignore_errors=False, onexc=None)
if scan_themes_for_scripts(theme_dir):
rmtree(theme_dir, ignore_errors=False, onerror=None)
rmtree(theme_dir, ignore_errors=False, onexc=None)
return False
return os.path.isfile(theme_dir + '/theme.json')