tab completion errors with ipython

Bug #1284420 reported by Mike McCoy
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Medium
Andreas Roehler

Bug Description

I'm trying to get Aquamacs 3.0a GNU Emacs 24.3.50.2 to become my IDE for python development, and I'd like to use iPython 1.2.0 as my interpreter (with Python 2.7.6). The relevant parts of my .emacs file are

    (require 'python-mode)

And in my `customizations.el` file:

    (custom-set-variables
     [...]
    '(py-force-py-shell-name-p t)
    '(py-python-command-args (quote ("-i" "--pylab")))
    '(py-shell-name "ipython")
    '(py-start-run-ipython-shell nil) [...]

I can start the iPython interpreter easily (e.g ^C^C from some python file), but tab completion is not working from the interpreter. For example, typing `pl` [tab] produces the message `progn: End of buffer`. If I instead use `M-x ipython-complete`, I get an error with the following backtrace:

    Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  format(nil "pl")
  (process-send-string proc (format ccs pattern))
  (if (string= pattern "") (tab-to-tab-stop) (process-send-string proc (format ccs pattern)) (accept-process-output proc 0.2) (if ugly-return (progn (setq completions (split-string (substring ugly-return 0 (position 10 ugly-return)) sep)) (if debug (progn (setq py-shell-complete-debug completions))) (py-shell-complete-finally)) (message "%s" "No response from Python process. Please check your configuration. If config is okay, please file a bug-regport at http://launchpad.net/python-mode")))
  (let* (py-fontify-shell-buffer-p (oldbuf (current-buffer)) (pos (or pos (copy-marker (point)))) (beg (or beg (save-excursion (skip-chars-backward "a-z0-9A-Z_." (point-at-bol)) (point)))) (end (or end (point))) (pattern (or word (buffer-substring-no-properties beg end))) (sep ";") (py-shell-name (or shell (py-choose-shell))) (processlist (process-list)) (imports (or imports (py-find-imports))) (py-completion-buffer py-ipython-completions) done (process (if ipython-complete-use-separate-shell-p (if (and (buffer-live-p py-ipython-completions) (comint-check-proc (process-name ...))) nil (get-buffer-process (py-shell nil nil py-shell-name py-ipython-completions t))) (progn (while (and processlist (not done)) (if (and ... ... ...) (progn)) (setq processlist (cdr processlist))) done))) (proc (or process (get-buffer-process (py-shell nil nil (if (string-match "[iI][pP]ython[^[:alpha:]]*$" py-shell-name) "ipython") nil t)))) (comint-output-filter-functions (delq (quote py-comint-output-filter-function) comint-output-filter-functions)) (comint-preoutput-filter-functions (append comint-preoutput-filter-functions (quote (ansi-color-filter-apply (lambda (string) (setq ugly-return ...) ""))))) (ccs (or completion-command-string (if imports (concat imports (py-set-ipython-completion-command-string)) (py-set-ipython-completion-command-string)))) completion completions completion-table ugly-return) (if (string= pattern "") (tab-to-tab-stop) (process-send-string proc (format ccs pattern)) (accept-process-output proc 0.2) (if ugly-return (progn (setq completions (split-string (substring ugly-return 0 (position 10 ugly-return)) sep)) (if debug (progn (setq py-shell-complete-debug completions))) (py-shell-complete-finally)) (message "%s" "No response from Python process. Please check your configuration. If config is okay, please file a bug-regport at http://launchpad.net/python-mode"))))
  ipython-complete()
  call-interactively(ipython-complete record nil)
  command-execute(ipython-complete record)
  execute-extended-command(nil "ipython-complete")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

Tags: ipython
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1284420] [NEW] tab completion errors with ipython
Download full text (3.8 KiB)

Am 25.02.2014 04:05, schrieb Mike McCoy:
> Public bug reported:
>
> I'm trying to get Aquamacs 3.0a GNU Emacs 24.3.50.2 to become my IDE for python development, and I'd like to use iPython 1.2.0 as my interpreter (with Python 2.7.6). The relevant parts of my .emacs file are
>
> (require 'python-mode)
>
> And in my `customizations.el` file:
>
> (custom-set-variables
> [...]
> '(py-force-py-shell-name-p t)
> '(py-python-command-args (quote ("-i" "--pylab")))
> '(py-shell-name "ipython")
> '(py-start-run-ipython-shell nil) [...]
>
> I can start the iPython interpreter easily (e.g ^C^C from some python
> file),

which would mean using a side-effect here.
M-x ipython RET should start it.

> but tab completion is not working from the interpreter.

TAB indents, it's also an edit-mode
M-TAB does completion

  For
> example, typing `pl` [tab] produces the message `progn: End of buffer`.
> If I instead use `M-x ipython-complete`, I get an error with the
> following backtrace:
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
> format(nil "pl")
> (process-send-string proc (format ccs pattern))
> (if (string= pattern "") (tab-to-tab-stop) (process-send-string proc (format ccs pattern)) (accept-process-output proc 0.2) (if ugly-return (progn (setq completions (split-string (substring ugly-return 0 (position 10 ugly-return)) sep)) (if debug (progn (setq py-shell-complete-debug completions))) (py-shell-complete-finally)) (message "%s" "No response from Python process. Please check your configuration. If config is okay, please file a bug-regport at http://launchpad.net/python-mode")))
> (let* (py-fontify-shell-buffer-p (oldbuf (current-buffer)) (pos (or pos (copy-marker (point)))) (beg (or beg (save-excursion (skip-chars-backward "a-z0-9A-Z_." (point-at-bol)) (point)))) (end (or end (point))) (pattern (or word (buffer-substring-no-properties beg end))) (sep ";") (py-shell-name (or shell (py-choose-shell))) (processlist (process-list)) (imports (or imports (py-find-imports))) (py-completion-buffer py-ipython-completions) done (process (if ipython-complete-use-separate-shell-p (if (and (buffer-live-p py-ipython-completions) (comint-check-proc (process-name ...))) nil (get-buffer-process (py-shell nil nil py-shell-name py-ipython-completions t))) (progn (while (and processlist (not done)) (if (and ... ... ...) (progn)) (setq processlist (cdr processlist))) done))) (proc (or process (get-buffer-process (py-shell nil nil (if (string-match "[iI][pP]ython[^[:alpha:]]*$" py-shell-name) "ipython") nil t)))) (comint-output-filter-functions (delq (quote py-comint-output-fi
lter-function) comint-output-filter-functions)) (comint-preoutput-filter-functions (append comint-preoutput-filter-functions (quote (ansi-color-filter-apply (lambda (string) (setq ugly-return ...) ""))))) (ccs (or completion-command-string (if imports (concat imports (py-set-ipython-completion-command-string)) (py-set-ipython-completion-command-string)))) completion completions completion-table ugly-return) (if (string= pattern "") (tab-to-tab-stop) (process-send-string proc (format ccs pattern)) (accept-process-output proc 0.2) ...

Read more...

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

Can't reproduce with current trunk. Maybe check out again?

Changed in python-mode:
status: New → Incomplete
Revision history for this message
Mike McCoy (michael-b-mccoy) wrote : Re: [Bug 1284420] Re: tab completion errors with ipython
Download full text (5.0 KiB)

The current trunk resolves the problem described above.

There appears to be another error when using tab-complete from a .py file.
 (Should I file a new bug report?)

Here's how to reproduce it with same settings described above:

1) Open some .py file and start ipython with M-x ipython.

2) Type `pl` M-tab in .py file buffer.

3) Receive one of the following messages:

error in process filter: Marker points into wrong buffer: #<marker (moves
after insertion) at 433 in *Ipython*>

OR

error in process filter: Args out of range: 424, 424

OR

error in process filter: font-lock-extend-jit-lock-region-after-change:
Args out of range: 424, 424

4) Oddly, the completion buffer opens as expected despite the error. So its
not fatal for my work.

Cheers,
-Mike

On Mon, Feb 24, 2014 at 11:28 PM, Andreas Roehler <<email address hidden>
> wrote:

> Can't reproduce with current trunk. Maybe check out again?
>
> ** Changed in: python-mode
> Status: New => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1284420
>
> Title:
> tab completion errors with ipython
>
> Status in An Emacs mode for editing Python code:
> Incomplete
>
> Bug description:
> I'm trying to get Aquamacs 3.0a GNU Emacs 24.3.50.2 to become my IDE for
> python development, and I'd like to use iPython 1.2.0 as my interpreter
> (with Python 2.7.6). The relevant parts of my .emacs file are
>
> (require 'python-mode)
>
> And in my `customizations.el` file:
>
> (custom-set-variables
> [...]
> '(py-force-py-shell-name-p t)
> '(py-python-command-args (quote ("-i" "--pylab")))
> '(py-shell-name "ipython")
> '(py-start-run-ipython-shell nil) [...]
>
> I can start the iPython interpreter easily (e.g ^C^C from some python
> file), but tab completion is not working from the interpreter. For
> example, typing `pl` [tab] produces the message `progn: End of
> buffer`. If I instead use `M-x ipython-complete`, I get an error with
> the following backtrace:
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
> format(nil "pl")
> (process-send-string proc (format ccs pattern))
> (if (string= pattern "") (tab-to-tab-stop) (process-send-string proc
> (format ccs pattern)) (accept-process-output proc 0.2) (if ugly-return
> (progn (setq completions (split-string (substring ugly-return 0 (position
> 10 ugly-return)) sep)) (if debug (progn (setq py-shell-complete-debug
> completions))) (py-shell-complete-finally)) (message "%s" "No response from
> Python process. Please check your configuration. If config is okay, please
> file a bug-regport at http://launchpad.net/python-mode")))
> (let* (py-fontify-shell-buffer-p (oldbuf (current-buffer)) (pos (or
> pos (copy-marker (point)))) (beg (or beg (save-excursion
> (skip-chars-backward "a-z0-9A-Z_." (point-at-bol)) (point)))) (end (or end
> (point))) (pattern (or word (buffer-substring-no-properties beg end))) (sep
> ";") (py-shell-name (or shell (py-choose-shell))) (processlist
> (process-list)) (imports (or imports (py-find-imports)))
> (py-completion-buffer py-ipython-...

Read more...

Changed in python-mode:
status: Incomplete → New
Changed in python-mode:
importance: Undecided → Medium
assignee: nobody → Andreas Roehler (a-roehler)
milestone: none → 6.1.4
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Please try again with latest changes.

Revision history for this message
Mike McCoy (michael-b-mccoy) wrote :
Download full text (9.3 KiB)

I updated and still see it. (To be clear, I moved the old python-mode
folder, and reinstalled with `bzr branch lp:python-mode`).

I opened a .py file and started ipython with `M-x ipython`.

Typed `pr M-tab`. Saw

In [3]: %%prun;%precision;%profile;%prun;print;property

but no error. Message said

`No response from Python process. Please check your configuration. If
config is okay, please file a bug-regport at
http://launchpad.net/python-mode`

Maybe I tried before the process loaded. So I typed `M-tab` again, and
that threw the error. Here's the backtrace:

Debugger entered--Lisp error: (error "Marker points into wrong buffer"
#<marker (moves after insertion) at 438 in *Ipython*>)
  comint-output-filter(#<process ipython>
"%%prun;%precision;%profile;%prun;print;property\n")
  accept-process-output(#<process ipython> 0.2)
  (if (string= pattern "") (tab-to-tab-stop) (process-send-string proc
(format ccs pattern)) (accept-process-output proc 0.2) (if ugly-return
(progn (setq completions (split-string (substring ugly-return 0 (position
10 ugly-return)) sep)) (if debug (progn (setq py-shell-complete-debug
completions))) (py-shell-complete-finally)) (message "%s" "No response from
Python process. Please check your configuration. If config is okay, please
file a bug-regport at http://launchpad.net/python-mode")))
  (let* (py-fontify-shell-buffer-p (oldbuf (current-buffer)) (pos (or pos
(copy-marker (point)))) (beg (or beg (save-excursion (skip-chars-backward
"a-z0-9A-Z_." (point-at-bol)) (point)))) (end (or end (point))) (pattern
(or word (buffer-substring-no-properties beg end))) (sep ";")
(py-shell-name (or shell (py-choose-shell))) (processlist (process-list))
(imports (or imports (py-find-imports))) (py-completion-buffer
py-ipython-completions) done (process (if
ipython-complete-use-separate-shell-p (if (and (buffer-live-p
py-ipython-completions) (comint-check-proc (process-name ...))) nil
(get-buffer-process (py-shell nil nil py-shell-name py-ipython-completions
t))) (progn (while (and processlist (not done)) (if (and ... ... ...)
(progn)) (setq processlist (cdr processlist))) done))) (proc (or process
(get-buffer-process (py-shell nil nil (if (string-match
"[iI][pP]ython[^[:alpha:]]*$" py-shell-name) "ipython") nil t))))
(comint-output-filter-functions (delq (quote
py-comint-output-filter-function) comint-output-filter-functions))
(comint-preoutput-filter-functions (append
comint-preoutput-filter-functions (quote (identity (lambda (string) (setq
ugly-return ...) ""))))) (ccs (or completion-command-string (if imports
(concat imports (py-set-ipython-completion-command-string))
(py-set-ipython-completion-command-string)))) completion completions
completion-table ugly-return) (if (string= pattern "") (tab-to-tab-stop)
(process-send-string proc (format ccs pattern)) (accept-process-output proc
0.2) (if ugly-return (progn (setq completions (split-string (substring
ugly-return 0 (position 10 ugly-return)) sep)) (if debug (progn (setq
py-shell-complete-debug completions))) (py-shell-complete-finally))
(message "%s" "No response from Python process. Please check your
configuration. If config is okay, please file a bug-regport at
http://launchpad...

Read more...

Revision history for this message
Andreas Roehler (a-roehler) wrote :
  • pr.png Edit (84.4 KiB, image/png; name="pr.png")

Am 27.02.2014 16:18, schrieb Mike McCoy:
> I updated and still see it. (To be clear, I moved the old python-mode
> folder, and reinstalled with `bzr branch lp:python-mode`).
>
> I opened a .py file and started ipython with `M-x ipython`.
>
> Typed `pr M-tab`. Saw
>
> In [3]: %%prun;%precision;%profile;%prun;print;property
>
> but no error. Message said
>
> `No response from Python process. Please check your configuration. If
> config is okay, please file a bug-regport at
> http://launchpad.net/python-mode`
>

That's strange. You should see a different error, introduced shortly and fixed yesterday.
Looks like recent python-mode.el is not loaded. Maybe an old "*.elc"-file around?

> Maybe I tried before the process loaded.

Process should be there

Please try the following:

Start from emacs -Q,
load python-mode.el, nothing else
M-x ipython RET
insert pr, M-TAB

attached the result from here

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

Got that bug yesterday too, hopefully fixed now. If not, please tell.

Changed in python-mode:
status: New → Fix Committed
Zuogong YUE (studentyue)
Changed in python-mode:
status: Fix Committed → Fix Released
Revision history for this message
Zuogong YUE (studentyue) wrote :

Sorry, by mistakes, I change the status, but cannot change it back. Really sorry.

no longer affects: archlinux
Revision history for this message
Zuogong YUE (studentyue) wrote :

I was just trying to find the python-mode.el with bug fixed. It is the first time I search around launchpad bug reports to find fix. So I made some mistakes. Please someone change the status back to "fix committed". Thanks!!

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

On 25.06.2014 23:46, Zuogong YUE wrote:
> I was just trying to find the python-mode.el with bug fixed. It is the
> first time I search around launchpad bug reports to find fix. So I made
> some mistakes. Please someone change the status back to "fix committed".
> Thanks!!
>

Don't worry. You are welcome.

BTW changing the status flags should be possible all the time.
Same mask you used already - might that change back also.

Make sure Js is activated.

If you change, please set it to "In progress" - working on it, it's still buggy.

Thanks,

Andreas

Revision history for this message
Zuogong YUE (oracleyue-deactivatedaccount) wrote :

I found that I cannot change the status any longer, even I registered a new account. Maybe once it is set to "fix release", it is no longer changeable by public users. Sorry for disturbing. The released version 6.1.3 does have this bug, which also affects me. When I use "bzr" to download the newest dev version, not work as well. I really hope someone could change the status back to "in progress".

BTW, could you offer a patch that 6.2.0 that might have fixed this bug? I use the newest dev version, when I run it on emacs 24.3, it has lots of errors. Maybe I should get to understand how to use such dev versions. (since I use archlinux, the launchpad is a really new place for me.)

Revision history for this message
Zuogong YUE (studentyue) wrote :

Just for your reference. Maybe you have known this info.

If using python.el, it works. IPython runs in the in "inferior python" mode, and TAB is binded to "python-shell-completion-complete-or-indent".
However if using python-mode, IPython runs under "comint" mode, and TAB is always binding to "py-indent-line" in "python-mode.el", instead of "python-shell-completion-complete-or-indent". But when I binded TAB to "python-shell-completion-complete-or-indent", some errors will be reported. Maybe I should read through the source code of "python-mode.el".

Changed in python-mode:
status: Fix Released → In Progress
Changed in python-mode:
status: In Progress → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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