2

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):

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.

2
  • To be clear, you're not asking how to fix this specific error (or more generally port Python 2 code to Python 3) but how to change ST's output on exceptions? Commented Oct 23, 2013 at 15:53
  • Yes, it's all about ST because normally ST does not thown such an error. Somerthing must be wrong there. Commented Oct 23, 2013 at 15:55

3 Answers 3

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
Sign up to request clarification or add additional context in comments.

Comments

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.

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:

import sys
sys.exit(1)

Change this to exit(0) and the output is just:

[Finished in 0.0s]

So looks just it's just Sublime's build tool trying to be helpful.

1 Comment

Cool, thanks for the help! And sorry If my opening post was not clear enough. btw. do you think I can automate this sys.exit(1) part inside of Sublime without having to type this code explicitly every time? I do not need this extended error message that Sublime build gives.
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')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.