Skip to content
Snippets Groups Projects
Commit 6344b5af authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Prevent a traceback when comparing two .rdx files directly as get_member will...

Prevent a traceback when comparing two .rdx files directly as get_member will return a file even if the file is missing and not raise a KeyError exception; we therefore explicitly test for the existence of the file.
parent b1a71c2f
No related branches found
No related tags found
No related merge requests found
......@@ -86,17 +86,17 @@ def get_module_path_for_rdb(rdb):
# Calculate location of parallel .rdx file
rdx_name = "{}.rdx".format(os.path.splitext(rdb.name)[0])
try:
# Query the container for the full path (eg. `./path/to/foo.rdx`)...
rdx = rdb.container.get_member(rdx_name)
except KeyError:
try:
# ... falling back to looking in the same directory for when
# comparing two .rdb files directly
rdx = rdb.container.get_member(os.path.basename(rdx_name))
except KeyError:
# Corresponding .rdx does not exist
return
# Query the container for the full path (eg. `./path/to/foo.rdx`)...
rdx = rdb.container.get_member(rdx_name)
if not os.path.exists(rdx.path):
# ... falling back to looking in the same directory for when
# comparing two .rdb files directly
rdx = rdb.container.get_member(os.path.basename(rdx_name))
if not os.path.exists(rdx.path):
# Corresponding .rdx does not exist
return
temp_dir = get_temporary_directory().name
prefix = os.path.join(temp_dir, "temp")
......
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