-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erroneous "IndentationError" with python #23
Comments
Hi. I think this is a Python syntax issue. It looks like the problem is that Python needs whitespace on line 9 (the empty line) to the level of either print statement to indicate that the second print is still inside the for loop, but Sublime Text is automatically stripping it. If I add whitespace on that line the script runs fine as a worksheet. (Note that it doesn't actually do anything because it is running in REPL mode, not as a command line script.) Check what you have in your Preferences.sublime-settings for "trim_automatic_white_space". |
I agree that's what Python (in -i mode) is expecting and failing on - the problem is that the program is legal Python even without that whitespace indentation on blank lines. In other words, it appears that python in interactive mode is pickier about its input than python is in normal (compiled?) mode. And thus worksheet unfortunately will fail on many files that would otherwise run just fine from the command line. Which is a bummer... |
You're right, sorry. There's a discussion of the issue here (wrt style): http://stackoverflow.com/questions/2727988/python-indentation-in-empty-lines Maybe I should add a note to the readme. |
Firstly, I admit that I'm not sure if this is more properly a bug in sublime-worksheet or a bug in python's interactive mode, but either way this unfortunately prevents me (and others, I would guess?) from using this tool which otherwise seems pretty cool...
Given code like this:
This runs just fine from the command line, but worksheet gives "IndentationError: unexpected indent" on line 10 (print arg). Is there anything that can be done about this? Unfortunately I get the same error if I save this file as foo.py and do:
The text was updated successfully, but these errors were encountered: