Virtualenv's pylint not found

Bug #1329217 reported by Andreas Roehler
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
New
Wishlist
Andreas Roehler

Bug Description

When I set up my virtual environment in emacs, I also configure flycheck's pylint to point to the executable that's in the virtual environment. The way I'm doing this right now is:

    (defun my-set-pylint-from-venv ()
      "Change flycheck pylint executable to virtualenv executable"
      (if (and (boundp 'virtualenv-name)
               (virtualenv-p (py--normalize-directory virtualenv-name)))
          (let ((pylintpath
                 (concat (py--normalize-directory virtualenv-name) "bin/pylint")

                 ))
            (setq flycheck-python-pylint-executable pylintpath)
            )))
    (add-hook 'python-mode-hook 'my-set-pylint-from-venv)

but this means if I open a Python file, then go "oh yeah, I need to set the virtual environment" and set it with (virtualenv-workon), then I also need to do (python-mode) again in order to hit the pylint executable hook.

The way I'd rather do this is make it a hook to (virtualenv-activate) or (virtualenv-workon) so I can stop restarting python-mode every time I switch venvs.

Is there a way to automate this that actually supports the workflow I've described?

Revision history for this message
Andreas Roehler (a-roehler) wrote :

virtualenv-activate should put the VE bin directory at the head of exec-path.
Thus VE pylint is expected to be found - needs some investigation why not.

For the moment you could advice virtualenv-activate with your function - and do the respective with virtualenv-deactivate. However, not seriously recommending that - let's cure the bug rather.

Changed in python-mode:
importance: Undecided → Medium
milestone: none → 6.2.0
Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
Changed in python-mode:
milestone: 6.2.0 → 6.2.1
Changed in python-mode:
importance: Medium → Wishlist
Changed in python-mode:
milestone: 6.2.1 → 6.2.3
Changed in python-mode:
milestone: 6.2.3 → 6.2.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.