2

I'm using ubuntu 14.04, emacs 24.3.1, python 2.7.6, ipython 1.2.1, python-mode 6.1.3. Ipython has been working well within emacs for at least a year, however, I have the following problem since two weeks ago.

  1. use C-c! to start default interpreter, ipython shows as I hoped, but instead of split frame and show in another window, it appears in the original code window. (this is a minor problem)
  2. use C-c| to execute a region, python interpreter starts, and the code sends to the python interpreter instead of ipython interpreter

I searched on SO, but this problem seems too recent to have an answer. I googled, found this page https://answers.launchpad.net/python-mode/+question/250905, tried methods therein, still didn't work... Could anyone help me fix the problem? Many thanks!

My .emacs python part looks like

 (require 'python-mode)
 (setq-default py-shell-name "ipython")
 (setq-default py-which-bufname "IPython")
 ; switch to the interpreter after executing code
 (setq py-shell-switch-buffers-on-execute-p t)
 (setq py-switch-buffers-on-execute-p t)
 ; don't split windows
 (setq py-split-windows-on-execute-p nil)
asked Oct 1, 2014 at 6:23

1 Answer 1

1

In order to split the window

(setq py-split-windows-on-execute-p t)

is needed, resp. reset to default - last line in example. Maybe check settings via M-x customize ... also, which may conflict with setq from init.

When selecting shell for execution: a shebang in buffer might override default py-shell-name. When shebang should be ignored, use

(setq py-force-py-shell-name-p t)

See menu

Python/Customize/Switches/Interpreter

for an easy way to change this value during current session.

answered Oct 1, 2014 at 10:24
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much, Andreas! (setq py-force-py-shell-name-p t) works! But when (setq py-split-windows-on-execute-p t), current code window keeps splitting until there are four windows, then I remember why I set it to nil... Anyway, I'll try tweaking more. One more question, is there a way to know which py-* variant does what besides reading python-mode.el?
@calbear You could check out the current trunk: bzr branch lp:python-mode. Bug lp:1361531 not solved yet - some improvement however should be feasible.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.