简体   繁体   中英

Apache error when executing Python cgi

Hi I have wrote a script for a webpage in python. However when I run it I seem to get this error

/usr/bin/env: python\r: No such file or directory
Premature end of script headers: users.cgi

I'm not sure what is causing it, so far I have:

  • A Shebang which is #!/usr/bin/env python
  • I also have other scripts that execute fine on the same server in the folder.
  • I have no syntax errors in the code (I've used IDLE to check)
  • The file also has 755 permissions and is owned by www-data

Could someone help me or point me in the right direction. I can't work out what is going wrong. There is very little in the apache error log. Your help will be greatly appreciated

You've uploaded the file with DOS/Windows line endings. UNIX script executables have to be saved with UNIX line endings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM