An Emacs mode for editing Python code

find file stuck in python mode

Asked by amazingjxq on 2012-11-07

If I use C-x C-f when the current buffer is a python file, emacs will stuck. I have to use C-g to quit. After that, the python shell came up and give something like this:

    >>> Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'emacs' is not defined

What can I do to solve this problem?

It is ok if I use M-x find-file, but not C-x C-f.

Question information

Language:
English Edit question
Status:
Solved
For:
python-mode.el Edit question
Assignee:
No assignee Edit question
Solved by:
amazingjxq
Solved:
2012-11-08
Last query:
2012-11-08
Last reply:
2012-11-07
amazingjxq (amazingjxq) said : #1

I set the variable debug-on-quit to t, and after I hit C-g emacs shows the following debug info

Debugger entered--Lisp error: (quit)
  accept-process-output(#<process python> 5)
  (progn (accept-process-output proc 5) (null python-preoutput-result))
  (while (progn (accept-process-output proc 5) (null python-preoutput-result)))
  (progn (set (make-local-variable (quote python-preoutput-result)) nil) (while (progn (accept-process-output proc 5) (null python-preoutput-result))) (prog1 python-preoutput-result (kill-local-variable (quote python-preoutput-result))))
  (if (python-check-comint-prompt proc) (progn (set (make-local-variable (quote python-preoutput-result)) nil) (while (progn (accept-process-output proc 5) (null python-preoutput-result))) (prog1 python-preoutput-result (kill-local-variable (quote python-preoutput-result)))))
  (when (python-check-comint-prompt proc) (set (make-local-variable (quote python-preoutput-result)) nil) (while (progn (accept-process-output proc 5) (null python-preoutput-result))) (prog1 python-preoutput-result (kill-local-variable (quote python-preoutput-result))))
  (save-current-buffer (set-buffer (process-buffer proc)) (when (python-check-comint-prompt proc) (set (make-local-variable (quote python-preoutput-result)) nil) (while (progn (accept-process-output proc 5) (null python-preoutput-result))) (prog1 python-preoutput-result (kill-local-variable (quote python-preoutput-result)))))
  (with-current-buffer (process-buffer proc) (when (python-check-comint-prompt proc) (set (make-local-variable (quote python-preoutput-result)) nil) (while (progn (accept-process-output proc 5) (null python-preoutput-result))) (prog1 python-preoutput-result (kill-local-variable (quote python-preoutput-result)))))
  (let ((proc (py-proc))) (with-current-buffer (process-buffer proc) (when (python-check-comint-prompt proc) (set (make-local-variable (quote python-preoutput-result)) nil) (while (progn (accept-process-output proc 5) (null python-preoutput-result))) (prog1 python-preoutput-result (kill-local-variable (quote python-preoutput-result))))))
  python-send-receive("emacs.modpath (\"10\")")
  python-module-path("10")
  byte-code("A !\207" [tem name] 2)
  ffap-file-at-point()
  ffap-guesser()
  ido-file-internal(raise-frame)
  ido-find-file()
  call-interactively(ido-find-file nil nil)

Andreas Roehler (a-roehler) said : #2

Am 07.11.2012 05:21, schrieb amazingjxq:
> New question #213527 on python-mode.el:
> https://answers.launchpad.net/python-mode/+question/213527
>
> If I use C-x C-f when the current buffer is a python file, emacs will stuck. I have to use C-g to quit. After that, the python shell came up and give something like this:
>
> >>> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'emacs' is not defined
>
> What can I do to solve this problem?
>
> It is ok if I use M-x find-file, but not C-x C-f.
>

did you try with latest python-mode.el, as bazaar delivers

bzr branch lp:python-mode

?

If yes, please open a report at "BUGS" and link your question.

Thanks,

Andreas

amazingjxq (amazingjxq) said : #3

This problem is caused by ffap(find file at point) in ido-find-file.
After I comment out the following line in my .emacs, it came back to normal.
 (setq ido-use-filename-at-point 'guess)