diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2024-01-04 11:15:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 11:15:56 +0300 |
commit | 397251ba0cc1a1df2c558c28c416b64eef73a051 (patch) | |
tree | c5bd1c25eae4d890b7f5f79d938ca5e04802bafc /modules/util.py | |
parent | 149c9d223463c8fc34f53f26ca06e02be4c8835b (diff) | |
parent | df62ffbd2525792c115adefdbaeb7799699624b1 (diff) |
Merge pull request #14527 from akx/avoid-isfiles
Avoid unnecessary `isfile`/`exists` calls
Diffstat (limited to 'modules/util.py')
-rw-r--r-- | modules/util.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/util.py b/modules/util.py index c2a27590..ee373e92 100644 --- a/modules/util.py +++ b/modules/util.py @@ -21,11 +21,11 @@ def html_path(filename): def html(filename):
path = html_path(filename)
- if os.path.exists(path):
+ try:
with open(path, encoding="utf8") as file:
return file.read()
-
- return ""
+ except OSError:
+ return ""
def walk_files(path, allowed_extensions=None):
|