Skip to content

Commit 2aea99d

Browse files
authored
BUG FIX: Use Path.relative_to() for Python 3.8 compatibility (#150)
1 parent ec406ff commit 2aea99d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

devtools/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def install() -> int:
6464
print(f'Found path `{install_path}` to install devtools into `builtins`')
6565
print('To install devtools, run the following command:\n')
6666
print(f' python -m devtools print-code >> {install_path}\n')
67-
if not install_path.is_relative_to(Path.home()):
67+
try:
68+
install_path.relative_to(Path.home())
69+
except ValueError:
6870
print('or maybe\n')
6971
print(f' python -m devtools print-code | sudo tee -a {install_path} > /dev/null\n')
7072
print('Note: "sudo" might be required because the path is in your home directory.')

0 commit comments

Comments
 (0)