Check that your Python script is in the "unix text file format." If it is in a "DOS/Windows text file format," Python will not interpret it correctly.
To solve this problem, upload your Python script in "ASCII" mode instead of "binary" mode. Your FTP server should translate your script to the appropriate format.
In addition to using the correct format, you also need to set execute permissions on your Python scripts. Permissions can be set using an FTP client or the FTP File Manager. For more information, see Set permissions.