diff --git a/lib/ansible/utils/path.py b/lib/ansible/utils/path.py index 717cef6cf01..41ed017ef43 100644 --- a/lib/ansible/utils/path.py +++ b/lib/ansible/utils/path.py @@ -45,7 +45,7 @@ def unfrackpath(path, follow=True, basedir=None): if basedir is None: basedir = os.getcwd() - elif os.path.isfile(basedir): + elif os.path.isfile(to_bytes(basedir, errors='surrogate_or_strict')): basedir = os.path.dirname(basedir) final_path = os.path.expanduser(os.path.expandvars(to_bytes(path, errors='surrogate_or_strict')))