Jump to content

[Solved] python3.7 throws 500, but python2.7 works


logdog

Recommended Posts

I'm on johnny.

both files in cgi-bin w/ 755

 

This  (lf37.py) gives me 500 error

#!/usr/bin/python3.7
 
print("Content-Type: text/html\n\n")
 
print("Heliohost rules!")
 

 

This (lf27.py) works

#!/usr/bin/python
import sys
 
print "Content-Type: text/html\n\n"
 
print "Heliohost rules!\n\n<BR>" 
print sys.version_info
 

Please advise.

Link to comment
Share on other sites

The difference is lf37.py has dos line endings, and lf27.py has linux line endings. This usually means that you created the lf37.py file on a windows computer and then uploaded it. To avoid a 500 error you must make sure your files have linux line endings. I've never used it myself, but I've heard the windows program notepad++ can save files with linux line endings. I'm sure there are others as well.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...