From 2aea99d95f4766fbca86139f72a1e4985d10a30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20S=C5=82awecki?= Date: Fri, 26 Jan 2024 20:10:51 +0100 Subject: [PATCH] BUG FIX: Use `Path.relative_to()` for Python 3.8 compatibility (#150) --- devtools/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devtools/__main__.py b/devtools/__main__.py index 2fbc79a..a5fa2f5 100644 --- a/devtools/__main__.py +++ b/devtools/__main__.py @@ -64,7 +64,9 @@ def install() -> int: print(f'Found path `{install_path}` to install devtools into `builtins`') print('To install devtools, run the following command:\n') print(f' python -m devtools print-code >> {install_path}\n') - if not install_path.is_relative_to(Path.home()): + try: + install_path.relative_to(Path.home()) + except ValueError: print('or maybe\n') print(f' python -m devtools print-code | sudo tee -a {install_path} > /dev/null\n') print('Note: "sudo" might be required because the path is in your home directory.')