0

I know this is a fairly common question but I've left no digital stone unturned and still can't find an answer that works for me.

I am running MAMP and Pythons 2.x and 3.x on a Mac running macOS Sierra. I am trying to learn Python CGI scripting and I am going through this tutorial.

So far, I am at the point where I test CGI (here). I've uploaded my file to the server with the name index.cgi, in /Applications/MAMP/cgi-bin/index.cgi. However, when navigating to http://localhost/cgi-bin/index.cgi I get 500 - Internal Server Error. This occurs regardless of whether I save as a .cgi or .py.

Here's what I've tried:

Here's the code in index.py/index.cgi:

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print("Content-Type: text/plain;charset=utf-8")
print()

print("Hello World!")

Any help would be hugely appreciated!

Community
  • 1
  • 1

2 Answers2

0

Have you tried setting the ScriptLog directive to get a more detailed error message?

  • I'm fairly new to this and so I haven't checked. I'll do that, thanks. –  Mar 10 '17 at 17:56
0

Change it to print("") instead of print().

Dennis Vash
  • 50,196
  • 9
  • 100
  • 118
Akash
  • 1
  • 1