2

I googled this and tried everything but I could not run my test.py on apache. I have updated httpd.conf file to AddHandler .py

URL I'm using is http://localhost/cgi-bin/test.py

test.py

#!/Library/Frameworks/Python.framework/Versions/3.4 python

print("Content-Type: text/html");
print();
print("<html><head></head><body>");
print ("Hello");
print("</body></html>");

I am not sure if the shebang line is correct or not, but that is where I've installed python.

When I open this file in browser I am getting this error

Error message: 
End of script output before headers: test.py

Please suggest, any help would be appreciated.

2 Answers 2

1

After going back and forth, I did this in terminal

which python

And I got path for my exe

#!/Library/Frameworks/anaconda/bin/python

I used this and my script worked, hope this helps to someone else too.

Sign up to request clarification or add additional context in comments.

Comments

0

Are you sure that is a correct path to your python installation? By default it should be something like

#!/Python27/python

1 Comment

that is where I installed python 3.4.3, I got that path from get info on mac

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.