Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 3 of 3

This is a discussion on Python - how to make it work in the Shared & Semi-Dedicated forum
I am trying to run a python script with CGI but have been unsucesful. Is there anything I have to do from the cpanel to ...

  1. #1
    JPC Member
    Join Date
    Apr 2002
    Posts
    4

    Question Python - how to make it work

    I am trying to run a python script with CGI but have been unsucesful.
    Is there anything I have to do from the cpanel to activate the .py files to run from the directory /cgi-bin/ ?

    This is the simple test program I am trying to run:

    #!/usr/bin/python2.2
    # Tell the browser how to render the text
    print "Content-Type: text/plain\n\n"
    print "Hello, Python!" # print a test string

    I also have tried as the first line:
    #!/usr/bin/python1.5 and #!/usr/bin/python

    and cannot make this simple script run.

    Other scripts like .pl files run with no problem from /cgi-bin/

    Python is installed, no question about it. I tested it from a ssh session.


    I will appreciate your help.

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    First and foremost, what permissions level (chmod) do you have the script set to? Scripts need to be set to 755 in order for the server to be able to run them. When you upload the script by FTP it is probably being set to 644 which is not executable.

    Anything that you put in a cgi-bin directory should be run as an executable, so I doubt the .py extension is the problem. Just for ha ha's, though, try changing it to .cgi if the permissions are not the problem. Since the serveer is unix (linux) based, file extensions don't matter, but I know that Apache is configured try and execuate all .cgi files, regardless of whehter they're in a cgi-bin directory or not.

    Hope this helps.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    Your script works fine on 'my' server...

    http://www.lenon.com/cgi-bin/hello_python.py

    Have you tried SnakeCharmer? It shows your Python environment!

    http://snakefarm.org/
    Last edited by Vin DSL; 12-06-2005 at 03:25 PM.
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •