Skip to content
Snippets Groups Projects
Commit 28147348 authored by Alexander Schlemmer's avatar Alexander Schlemmer Committed by Henrik tom Wörden
Browse files

FIX: replaced an assertion with a corresponding error

parent 990c33bd
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,13 @@ import os ...@@ -26,7 +26,13 @@ import os
def replace_path_prefix(path, old_prefix, new_prefix): def replace_path_prefix(path, old_prefix, new_prefix):
assert path.startswith(old_prefix) """
Replaces the prefix old_prefix in path with new_prefix.
Raises a RuntimeError when the path does not start with old_prefix.
"""
if not path.startswith(old_prefix):
raise RuntimeError("Path does not start with old_prefix")
path = path[len(old_prefix):] path = path[len(old_prefix):]
return os.path.join(new_prefix, path) return os.path.join(new_prefix, path)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment