Skip to content

Commit fb23eea

Browse files
committed
Improve error reporting if DLL path is missing
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 4266db6 commit fb23eea

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/commoncode/command.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ def load_shared_library(dll_path, lib_dir):
201201
`lib_dir` to the path.
202202
"""
203203

204-
if not path.exists(dll_path):
205-
raise ImportError('Shared library does not exists: %(dll_path)r' % locals())
204+
if not dll_path or not path.exists(dll_path):
205+
raise ImportError(f'Shared library "dll_path" does not exists: dll_path="{dll_path}" and lib_dir={lib_dir})')
206206

207207
if lib_dir and not path.exists(lib_dir):
208-
raise ImportError('Shared library "lib_dir" does not exists: %(lib_dir)r' % locals())
208+
raise ImportError(f'Shared library "lib_dir" does not exists: dll_path="{dll_path}" and lib_dir={lib_dir})')
209209

210210
if not isinstance(dll_path, str):
211211
dll_path = os.fsdecode(dll_path)

0 commit comments

Comments
 (0)