Skip to content

Erroneous "IndentationError" with python #23

@ianrose14

Description

@ianrose14

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:

#!/usr/bin/env python
import sys

def main():
  args = sys.argv[1:]
  for arg in args:
    if '.' in arg:
      print 'great!'

    print arg

if __name__ == '__main__':
  main()

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:

cat foo.py | python -i

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions