diff --git a/tools/check_python_dependencies.py b/tools/check_python_dependencies.py index f68f887e9..396d52cc9 100755 --- a/tools/check_python_dependencies.py +++ b/tools/check_python_dependencies.py @@ -25,13 +25,20 @@ except: 'setting up the required packages.') sys.exit(1) +def escape_backslash(path): + if sys.platform == "win32": + # escaped backslashes are necessary in order to be able to copy-paste the printed path + return path.replace("\\", "\\\\") + else: + return path + if __name__ == "__main__": idf_path = os.getenv("IDF_PATH") parser = argparse.ArgumentParser(description='ESP32 Python package dependency checker') parser.add_argument('--requirements', '-r', help='Path to the requrements file', - default=idf_path + '/requirements.txt') + default=os.path.join(idf_path, 'requirements.txt')) args = parser.parse_args() # Special case for MINGW32 Python, needs some packages @@ -70,7 +77,7 @@ if __name__ == "__main__": print(requirement) print('Please refer to the Get Started section of the ESP-IDF Programming Guide for setting up the required ' 'packages. Alternatively, you can run "{} -m pip install --user -r {}" for resolving the issue.' - ''.format(sys.executable, args.requirements)) + ''.format(escape_backslash(sys.executable), escape_backslash(args.requirements))) sys.exit(1) print('Python requirements from {} are satisfied.'.format(args.requirements))