help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

let*: Wrong type argument: stringp, nil


From: Hongyi Zhao
Subject: let*: Wrong type argument: stringp, nil
Date: Fri, 24 Sep 2021 22:52:45 +0800

According to the idea represented here [1], I wrote the following
function to activate the python virtual environment automatically
using the content of the ".python-version" file located in the project
directory of the current opened python file:

(defun pyvenv-autoload ()
    (require 'projectile)
    (let* ((pdir (file-name-directory buffer-file-name)) (pfile
(concat pdir ".python-version")))
      (if (file-exists-p pfile)
          (pyvenv-workon (with-temp-buffer
                           (insert-file-contents pfile)
                           (nth 0 (split-string (buffer-string))))))))
(add-hook 'python-mode-hook 'pyvenv-autoload)

It seems the corresponding python virtual environment can be activated
automatically when I open the python file in Emacs. But when I try to
evaluate the file, the following message will be triggered, and defeat
the evaluate operation:

let*: Wrong type argument: stringp, nil

[1] https://github.com/jorgenschaefer/pyvenv/issues/51#issuecomment-253902450

Any hints for fixing this problem?

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



reply via email to

[Prev in Thread] Current Thread [Next in Thread]