Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
ipython does not like white space at end of file #1027
ipython does not handle whitespace at end of files in the same way as python itself does.
Test file 'whitespace_at_eof.py at: https://gist.github.com/1385125
This file contains one print statement and on the last line there are four spaces.
ipython from commandline:
This was tested on windows 7 python2.6 ipython master 30385c4
Note that the error appears in a Windows specific branch - on Posix systems, we call the built in execfile instead of compile-ing the source ourselves. However, when I call compile manually on the equivalent text, it doesn't appear to raise any errors, so maybe it's a difference in Python on Windows.
Ah, thanks for the info @takluyver. Indeed, tailing whitespace is disallowed:
Fixing it now (I'll do only
It seems we should have added the "\n" at the end of the line, I guess things work differently when there is a comment at the end of the file.
I get this error message now when starting ipython:
It goes away if I add +"\n" at the end of line 161 in py3compat.py.