diff --git a/le-python.el b/le-python.el index 57368da5..71b75710 100644 --- a/le-python.el +++ b/le-python.el @@ -298,8 +298,9 @@ it at one time." (defvar lispy--python-init-file nil) (defun lispy--python-poetry-name () - (let ((pyproject - (file-name-directory (locate-dominating-file (buffer-file-name) "pyproject.toml")))) + (when-let* ((bfn (buffer-file-name)) + (root (locate-dominating-file bfn "pyproject.toml")) + (pyproject (file-name-directory root))) (and (file-exists-p pyproject) (not (equal python-shell-interpreter "python")) (with-current-buffer (find-file-noselect pyproject)