Jump to content

[Answered] Getting Python to work...


Matrix_Square

Recommended Posts

Hi gang,

 

I can't believe I still can't get Python to work. I followed the instruction pretty darn clearly (after all, how hard can it be to add a Shebang line and plunk the file into the cgi-bin folder?!), yet the server keeps on me a Internal Server Error (500) as follows:

Internal Server Error

 

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, webmaster@mse.heliohost.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

My file is simply called processing.py and it "should" be accessible by using www.mse.heliohost.org/cgi-bin/processing.py, but it's not.

 

Any ideas? Or did I set something up incorrectly? Do I have to fiddle around with the .htaccess file to give access to anything in particular? Or anything I might have missed? Etc.

 

I'm at my wit's end, help!

Link to comment
Share on other sites

I never use Python but I just tried a simple Hello World and got a 500 Error and that was with a .py and a .cgi extension. So Python must not be working on the server.

 

#!/usr/bin/python
print "Content-Type: text/html\n\n"
print "Hello World"

 

btw, you can make all directories execute cgi with .htaccess and I'm guessing it does the same thing with Python.

 

EDIT:

 

Try adding the python handler to your .htaccess file:

 

AddHandler python-program .py

 

or use the Apache Handler option from your cpanel to add it:

 

python-program .py

 

 

 

Link to comment
Share on other sites

  • 4 months later...

Like I said in my previous post, I don't know anything about python but I was able to get this script to work a few months back by using a cgi extension.

 

http://byrondallas.heliohost.org/cgi-bin/snakecharmer.cgi

 

 

 

Maybe you can find an answer from a heliohost forum search?

 

http://www.helionet.org/index/index.php?ac...highlite=python

 

 

Link to comment
Share on other sites

My "snakecharmer.py" file is working fine. I'll investigate this a little and get back to you guys.

 

UPDATE

Well, I copied the snakecharmer file to a test account. It gave me a 500, but I refreshed three times and then it started to work. Is anybody's Python script working now, or after a couple of refreshes?

Link to comment
Share on other sites

  • 3 months later...

the problem seems to be somewhere in between server and database...

I get the error (500) once I try to connect to database (put any info regarding it in settings.py)

 

This eventually means Django cannot be used for any database apps.

Hope this issue will be investigated - can try and help but my knowledge in terms of (server configuration, wsgi) is very rudimentary...

Link to comment
Share on other sites

  • 1 month later...

My python file is also showing up as text as you can see:

 

http://zjeroen.heliohost.org/script1.py

http://www.zjeroen.heliohost.org/cgi-bin/script1.py

 

I've set the permissions to 0755 and added the line

AddHandler python-program .py

to my .htaccess. It's showing up in the Apache Handlers in cpanel.

 

My source is:

 

#!/usr/bin/python

print "Content-Type: text/html"     
print                               

print "Alive"

 

 

@Byron: What's the source of that snakecharmer.py? and what did you do to make ik work?

Link to comment
Share on other sites

@Byron: What's the source of that snakecharmer.py? and what did you do to make ik work?

 

I had to run it with a .cgi extension or it would show up as text. I also have the addhander directive in my htaccess.

 

http://byrondallas.heliohost.org/cgi-bin/snakecharmer.cgi

 

http://byrondallas.heliohost.org/cgi-bin/snakecharmer.py

 

source

http://byrondallas.heliohost.org/temp/snakecharmer.txt

 

Link to comment
Share on other sites

Can you point me why it always throw 500 internal server error on my account? Link http://karak.heliohost.org/cgi-bin/snakecharmer.cgi

 

I think you'd be better off uploading this text file and then renaming it with a cgi extension instead of copy and pasting.

 

http://byrondallas.heliohost.org/temp/snakecharmer.txt

 

Make sure your file permissions are 755.

 

 

Link to comment
Share on other sites

  • 3 weeks later...

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