Jump to content

Python Script Not Working


sagnik

Recommended Posts

Hey I'm Sagnik! I've a problem on Python Scripts. I had a Python Script, when I'm opening the file in the browser, the script is showing as plain text instead of running. I've added the apache handler "cgi-script" as extentions ".cgi .pl .py .perl .ppl" and I've changed the permition of the script to "0755". But it not works. Please help me as soon as possible.

Link to comment
Share on other sites

Sir, it doesn't works. When I've added the code to .htaccess file then when I'm opening any of my file, then I'm getting a 500 Internal Server Error.

 

Please help me.

Link to comment
Share on other sites

Python script is not

working when

openin .py file I'm

getting 500 Internal

Server Error. I've set the

file permition of the

python script to "0755"

and I've added the code

"AddHandler cgi-

script .py .cgi .pl .perl" to

the .htaccess file and

also I've added the

handler "cgi-script" as

".py .cgi .pl .perl" from

cPanel's "Apache

Handler" section. Yet,

I'm getting the "500

Internal Server Error".

Please Help Me. Also I've

posted this problem on

the HelioNet's "General

Discussion" section.

Link to comment
Share on other sites

You can post the python script in the post too, or upload it to online services like pastebin, etc.

 

Also check in your python script that you have the shebang line

#!/usr/bin/python

Also, the first line should be always

print("Content-Type: text/html\n\n");

 

 

Link to comment
Share on other sites

here is my python code:

#!/usr/bin/python

print("Content-Type:

text/html\n\n");name=raw_input('Enter

your name:')

print ("Hi %s, Let us be

friends!" % name);

so what is the problem?

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...