Skip to content

Commit

Permalink
[FIX] load_data: fail early on missing path (#380)
Browse files Browse the repository at this point in the history
[FIX] load_data: fail early on missing path

Without this patch, if you call this function with a filename that can't be found, you'll get a confusing error like `NameError: name 'fp' is not defined`, that gives no details about the real problem.

@moduon MT-7047
  • Loading branch information
yajo authored Sep 2, 2024
1 parent a133cda commit 9f5fd6c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openupgradelib/openupgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ def load_data(env_or_cr, module_name, filename, idref=None, mode="init"):
break
except OSError: # pylint: disable=W7938
pass
else:
raise OSError(
"Couldn't find file %s in the upgrade paths (%s)"
% (filename, tools.config["upgrade_path"])
)
else:
raise

Expand Down

0 comments on commit 9f5fd6c

Please sign in to comment.