我正在使用最新的emacs25.1.1和最新的archlinux。
但是,当我编辑python脚本并使用Ctrl-Enter将其发送到Inferior ipython时,劣质Python会向我显示一个丑陋的代码类似指示符,如:
Python 3.5.2 (default, Nov 7 2016, 11:31:36)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[JIn [1]: import numpy as np[26D
[J
[6n[JIn [2]: [8D[8C[8D[J[6n[JIn [2]: [8D[8C
在此Inferior python中按Enter键时,显示:
error in process filter: Args out of range: "
^[[6n^[[0m^[[0m^[[J^[[0;38;5;28mIn [^[[0;38;5;28m: ^[[8D^[[8C[[0m^[[0m", 128
我从以下位置更改emacs区域设置:
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
要:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
使用命令$" export LANGUAGE =" en_US:en" &安培;&安培; emacs" $,无助于解决凌乱的代码。
我也在emacs中尝试python-mode.et或elpy包,都显示相同 凌乱的终端代码。
此外,python2.7也尝试过,没有工作:
Python 2.7.12 (default, Nov 7 2016, 11:55:55)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[JIn [1]: import numpy as np[26D
[J
[6n[JIn [2]: [8D[8C[8D[J[6n[JIn [2]: [8D[8C
最新的ipython问题?
最后,emacs中的消息粘贴在这里:
error in process filter: ansi-color-filter-apply: Args out of range: "Python 3.5.2 (default, Nov 7 2016, 11:31:36)
Type \"copyright\", \"credits\" or \"license\" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[6n[0m
[0m[J
[0m", 408
error in process filter: Args out of range: "Python 3.5.2 (default, Nov 7 2016, 11:31:36)
Type \"copyright\", \"credits\" or \"license\" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[6n[0m
[0m[J
[0m", 408
error in process filter: ansi-color-filter-apply: Args out of range: "[0m[0m[J[0;38;5;28mIn [[0;38;5;10;1m1[0;38;5;28m]: [0;38;5;28;1mimport[0m [0;38;5;32;1mnumpy[0m [0;38;5;28;1mas[0m [0;38;5;32;1mnp[26D[0m
[J[0m", 177
error in process filter: Args out of range: "[0m[0m[J[0;38;5;28mIn [[0;38;5;10;1m1[0;38;5;28m]: [0;38;5;28;1mimport[0m [0;38;5;32;1mnumpy[0m [0;38;5;28;1mas[0m [0;38;5;32;1mnp[26D[0m
[J[0m", 177
error in process sentinel: elpy-rpc--default-error-callback: peculiar error: "exited abnormally with code 1"
error in process sentinel: peculiar error: "exited abnormally with code 1"
error in process filter: ansi-color-filter-apply: Args out of range: #("[JIn [1]: import numpy as np[26D
[J
[6n[0m[0m[J[0;38;5;28mIn [[0;38;5;10;1m2[0;38;5;28m]: [8D[8C[0m[0m[8D[J[0m[6n[0m[0m[J[0;38;5;28mIn [[0;38;5;10;1m2[0;38;5;28m]: [8D[8C[0m" 0 38 (fontified nil) 38 39 (fontified nil)), 283
error in process filter: Args out of range: #("[JIn [1]: import numpy as np[26D
[J
[6n[0m[0m[J[0;38;5;28mIn [[0;38;5;10;1m2[0;38;5;28m]: [8D[8C[0m[0m[8D[J[0m[6n[0m[0m[J[0;38;5;28mIn [[0;38;5;10;1m2[0;38;5;28m]: [8D[8C[0m" 0 38 (fontified nil) 38 39 (fontified nil)), 283
答案 0 :(得分:4)
我使用了https://github.com/jorgenschaefer/elpy/issues/992#issuecomment-249165923的推荐。简而言之 - 添加以下代码:
(setenv "IPY_TEST_SIMPLE_PROMPT" "1")
进入emacs配置文件。
答案 1 :(得分:0)
从输出和错误消息中,看起来由于某种原因,您的设置不处理ipython使用的ansi转义序列。假设您使用的是pythong-mode,请确保您拥有以下内容
(setq python-shell-interpreter "ipython"
python-shell-interpreter-args "-i")
要消除init文件中的其他可能设置,我会注释掉除上述内容之外的所有内容,然后重试。如果它工作,那么你的设置中有一些东西正在弄乱emacs处理ipython输出的ansi控制序列的能力。如果它仍然无法正常工作,那么您可能需要记录错误报告。
还可以采取一些措施来解决这个问题。