I've just switched to Sublime Text 3 (from ST 2 actually) and I am getting this annoying error message when executing an invalid code. Say, I run this code (which is of course invalid in Python 3):
我刚刚切换到崇高的文本3(实际上是来自于ST 2),在执行无效代码时,我得到了这个恼人的错误消息。比方说,我运行这个代码(在Python 3中当然是无效的):
print 'this'
I am getting this extended error message from my Sublime:
我从崇高中得到了这个扩展错误信息:
SyntaxError: invalid syntax
[Finished in 0.2s with exit code 1]
[shell_cmd: python -u "C:\Users\Myname\Desktop\working.py"]
[dir: C:\Users\Myname\Desktop]....CUT HERE...
So alongside the exception Sublime is printing all the environment variable paths that I have. I am guessing this is abnormal behavior? or do you get this kind of error messages as well on Sublime Text 3?
除了卓越之外,还有打印所有的环境变量路径。我猜这是反常的行为?或者你也会收到这样的错误信息吗?
If this is of any relevance, I have both Python27 and Python 33 installed, although only Python33 is put into variable paths.
如果这是任何关联的,那么我已经安装了Python27和Python33,尽管只有Python33被放到了变量路径中。
3 个解决方案
#1
2
Took me too long to notice you aren't talking about Sublime's plug-in interface (that uses an embedded copy of Python 3), but about the "Build" command that just runs the file in the Python interpreter found in the PATH.
我花了很长时间才注意到,您不是在讨论Sublime的插件接口(它使用了Python 3的嵌入式副本),而是关于“构建”命令,该命令只在路径中找到的Python解释器中运行该文件。
To answer your question- yes, I get this kind of messages whenever I run some code in Python that exits with non-0 exit code. Could just be:
为了回答您的问题——是的,每当我在Python中运行带有非0退出代码的代码时,我就会得到这种消息。可以是:
import sys
sys.exit(1)
Change this to exit(0)
and the output is just:
将其更改为exit(0),输出为:
[Finished in 0.0s]
So looks just it's just Sublime's build tool trying to be helpful.
所以看起来,这只是崇高的构建工具,试图提供帮助。
#2
3
Install the Better Build System package. Add these settings to your user preferences (Preferences -> Settings - User):
安装更好的构建系统包。将这些设置添加到您的用户首选项(首选项->设置-用户):
"show_panel_on_failed_build_only": false,
"show_debug_text": false,
"show_panel_on_build": true
#3
0
According this documentation, https://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function you need to include parenthesis like this print ('this')
根据这个文档,https://docs.python.org/3.0/whatsnew/3.0.html# print-_function你需要包含像这样的括号('this')
#1
2
Took me too long to notice you aren't talking about Sublime's plug-in interface (that uses an embedded copy of Python 3), but about the "Build" command that just runs the file in the Python interpreter found in the PATH.
我花了很长时间才注意到,您不是在讨论Sublime的插件接口(它使用了Python 3的嵌入式副本),而是关于“构建”命令,该命令只在路径中找到的Python解释器中运行该文件。
To answer your question- yes, I get this kind of messages whenever I run some code in Python that exits with non-0 exit code. Could just be:
为了回答您的问题——是的,每当我在Python中运行带有非0退出代码的代码时,我就会得到这种消息。可以是:
import sys
sys.exit(1)
Change this to exit(0)
and the output is just:
将其更改为exit(0),输出为:
[Finished in 0.0s]
So looks just it's just Sublime's build tool trying to be helpful.
所以看起来,这只是崇高的构建工具,试图提供帮助。
#2
3
Install the Better Build System package. Add these settings to your user preferences (Preferences -> Settings - User):
安装更好的构建系统包。将这些设置添加到您的用户首选项(首选项->设置-用户):
"show_panel_on_failed_build_only": false,
"show_debug_text": false,
"show_panel_on_build": true
#3
0
According this documentation, https://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function you need to include parenthesis like this print ('this')
根据这个文档,https://docs.python.org/3.0/whatsnew/3.0.html# print-_function你需要包含像这样的括号('this')