jorgenschaefer/pyvenv

"Output from the virtualenvwrapper hook post_activate:" buffer keeps appearing

Closed this issue · 3 comments

Hi,

Firstly, thanks for a great package :)

Secondly, After upgrading to emacs27.1 and also upgrading to the latest pyvenv, I keep getting a buffer with:

Output from the virtualenvwrapper hook post_activate:

appearing every time I change the virtualenv via pyvenv-workon or pyvenv-activate which is quite annoying. Running e.g. workon my-env in the terminal works as per normal.

I expect it's probably me doing something wrong (my emacs-fu is very poor), but I'm really stumped by this and have resorted to just deleting some code in my local install to stop this - any help to a proper fix would be amazing.

my init.el is here and I think the relevant lines are:

  (use-package pyvenv
    :ensure t
    :bind
    (:map pyvenv-mode-map
          ("C-c q" . pyvenv-restart-python)
          ("C-c o" . pyvenv-workon))
    :init
    (pyvenv-mode)
    (pyvenv-tracking-mode)
    :config
    (pyvenv-workon "pymacs"))

thanks!

From what I can tell, virtualenvwrapper hooks are returning a single byte of output. It's not clear to me if this is a change in virtualenvwrapper or emacs call-process.

I'm currently using virtualenvwrapper 4.8.4 and both emacs 27.1 and emacs:HEAD on Linux and macOS respectively and getting the same problem on both.

Changing this line:

(when (> (length output) 0)

To:

when (> (length output) 1)

Makes the symptom go away. Remember to byte-compile-file w/ Doom and similar distros since they'll prefer the .elc even if it's old.

(let ((output (string-trim (buffer-substring hook-output-start-pos could be safer,
I've opened #103

Thanks all for the comments, I've started using #103 which fixes this, would be great to get that, or similar, merged in.