(I now submitted this as an issue in GitHub: https://github.com/jorgenschaefer/elpy/issues/1249)

I'm using Emacs 25.3.1, Elpy v20171212.850, and Python 3.6.3 on MacOS 10.13.2 .

I have a project tracked with Git in ~/MyProject, with the usual git data in ~/MyProject/.git and ~/MyProject/.gitignore. I have some Python modules in ~/MyProject/Python. If, for example, I open one of these modules and, from that buffer, call elpy-shell-switch-to-shell, or elpy-shell-send-region-or-buffer, then Elpy starts a new Python process in ~/MyProject instead of ~/MyProject/Python. This odd behaviour has only started occurring recently (might be since the last Elpy upgrade, but not sure - I upgrade fairly frequently).

Interestingly, if I delete the Git data and kill/reopen the Python module (simply killing the Python REPL buffer is insufficient), then Elpy behaves properly, starting the Python process in ~/MyProject/Python.

Any idea how I can debug this?


Answered at github:

You can set elpy-shell-use-project-root to nil to start the shell in the directory of the Python file as before. Alternatively, modify your MyProject/Python directory so that it is detected as a project root; see elpy-project-root-finder-functions.

The elpy-project-root-finder-functions have the options:

  • Projectile project root
  • Python project (setup.py, setup.cfg)
  • Git repository root (.git)
  • Mercurial project root (.hg)
  • Subversion project root (.svn)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.