+1 as suggested by ignacio.
however, to answer the first part of your question more directly, each OS / system uses a different line ending character:
POSIX (any Unix flavor like Linux, * BSD, Mac OS X, etc.) uses \n (NEWLINE), while DOS / Win uses the combo \r\n (CR / carriage return + NEWLINE ), and the old Mac OS 8 or 9 uses only CR or \r .
to solve this problem, you can run the utility, as ignacio suggested, or you should be able to do this from your text editor (perhaps this is not very obvious).
to answer another part of your question, the reason $ python myProgram works is because Python treats all three different ends of the line the same way ... the shebang line at the top is ignored because you told Python to load and run the script, and " # "means that the first line is a comment and therefore ignored.
when you tell the shell of your OS to execute it, you need to analyze this line and execute any interpreter you requested, but if this is not possible, it will intimidate you, as it were.
hope this helps!
ps. on a side note, you can find out which line termination character is used in your operating system, just check the os.linesep (data) attribute. for example, on my Mac (OS X), I get the following:
>>> import os >>> os.linesep '\n'
here is a brief description of other related attributes that I plagiarized from the hardcore Python intro-course notes : 