Python 3.1和升华文本2错误
我想使用SublimiteText2作为IDE在Python中开发应用程序 我有以下问题: 当我创建一个新文件时,将其另存为python并执行工具->构建系统->python CTRL+B 我得到这个错误:Python 3.1和升华文本2错误,python,python-3.x,sublimetext,Python,Python 3.x,Sublimetext,我想使用SublimiteText2作为IDE在Python中开发应用程序 我有以下问题: 当我创建一个新文件时,将其另存为python并执行工具->构建系统->python CTRL+B 我得到这个错误: Please type your name and press enter: Traceback (most recent call last): File "/Users/strielok/Desktop/hello.py", line 1, in <module>
Please type your name and press enter: Traceback (most recent call last):
File "/Users/strielok/Desktop/hello.py", line 1, in <module>
personsname = raw_input("Please type your name and press enter: ")
EOFError: EOF when reading a line
[Finished]
然而,当我从终端(我在Mac上)运行这段代码时,它工作得非常好
你知道问题出在哪里吗?摘自Sublime Text的论坛,似乎stdin不会与任何东西联系在一起,所以这是意料之中的
来源:安装Submizerepl,然后选择
工具->Submizerepl->python
参考资料:我已经编写了一个允许在sublime文本中的构建获取输入的程序。边缘有点粗糙,但它在我的机器上工作。代码第二行的缩进是吗?我只能猜测,但这种猜测是升华关闭或不创建应用程序的标准输入。最好在论坛上提问。除了stdin的问题外,您似乎并没有在Python 3.1中实际运行它,因为
raw\u input
在Python 3上只是input
。正如@ThomasK所示,这两行中没有一行(raw\u input和print As a statement)在py3kLink中工作,因此不再有效。
personsname = raw_input("Please type your name and press enter: ")
print "Hello " +personsname