Emacs python-mode下奇怪的EOFError: EOF when reading a line问题

    技术2022-05-20  47

     

    Emacs有一个python-mode,使得编写python程序非常方便,但是却因为集成在emacs编辑器里,会出一些直接在shell下没有的问题。

    比如有这么一段python程序:

    #!/usr/bin/python str = raw_input("Prompt:") 

    bash下直接运行没有问题:

    cheryl@debian:~$ python test_input.py Prompt:It works in bash now! cheryl@debian:~$

    但是在Emacs里使用py-execute-buffer(默认绑定快捷键为C-c C-c)却出现错误:

     

    这是因为Emacs的python-mode里默认没有给你提供一个可以输入的buffer,为了能输入,你需要先执行py-shell(默认绑定为C-c !),之后就会打开一个Python Shell窗格,这时候切换回python代码的buffer,再执行py-excute-buffer(C-c C-c),再切换回Python Shell的窗格,就可以正常输入了。

     

     


    最新回复(0)