From ce4bab05b7e4d3429a0f1dce1cc95f91867726b6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 4 Jul 2024 12:08:20 +0100 Subject: [PATCH] Replace deprecated rmtree argument --- media.py | 2 +- newsdaemon.py | 2 +- posts.py | 2 +- theme.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/media.py b/media.py index 4cd729dce..3c0b21d93 100644 --- a/media.py +++ b/media.py @@ -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 diff --git a/newsdaemon.py b/newsdaemon.py index cefbc84dd..50c9ce108 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -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 diff --git a/posts.py b/posts.py index 103f7ba5c..0495b8747 100644 --- a/posts.py +++ b/posts.py @@ -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)) diff --git a/theme.py b/theme.py index bc614a987..0b1c03c7f 100644 --- a/theme.py +++ b/theme.py @@ -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')