Jump to content


VlexoFree Notice

Interviews will be open every Friday starting at 12am PDT and lasting for 24 hours.

- - - - -

PYTHON


  • Please log in to reply
3 replies to this topic

#1 andriy

andriy

    Member

  • Pre-Members
  • 14 posts

Posted 11 February 2011 - 07:02 AM

Could anyone explain how to make python work on this server?

Ad Bot


      #2 andriy

      andriy

        Member

      • Pre-Members
      • 14 posts

      Posted 11 February 2011 - 08:33 AM

      Now it is working.
      I put python script into cgi-bin directory.
      Here are some tips which I found.
      1) The first line of the script must contain the python command (#!/usr/bin/env python). There must not be a blank line (or anything else) before the first line.
      2) The line import cgi must be somewhere at the beginning.
      3) The very first print statement of your script must be print "Content-Type: text/html\n"
      4) The file permissions must be set to executable (chmod u+x filename).
      5) The script should be executed on the command line to check the syntax before looking at it through the browser.

      #3 de1337ed

      de1337ed

        Newbie

      • Members
      • 7 posts

      Posted 04 April 2011 - 01:02 AM

      View Postandriy, on 11 February 2011 - 08:33 AM, said:

      Now it is working.
      I put python script into cgi-bin directory.
      Here are some tips which I found.
      1) The first line of the script must contain the python command (#!/usr/bin/env python). There must not be a blank line (or anything else) before the first line.
      2) The line import cgi must be somewhere at the beginning.
      3) The very first print statement of your script must be print "Content-Type: text/html\n"
      4) The file permissions must be set to executable (chmod u+x filename).
      5) The script should be executed on the command line to check the syntax before looking at it through the browser.

      can you give me more tips on the cgi, I still can't get it to work, here's my code:

      #!/usr/bin/env/python
      import cgi
      import cgitb
      cgitb.enable()

      print "Content-type: text/html\n"
      print "<html><head><title>hello</title></head>"
      print "<body>HI</body>"
      print "</html>"

      #4 BeanMe

      BeanMe

        Newbie

      • Members
      • 9 posts

      Posted 08 January 2012 - 01:43 AM

      Put it in the cgi-bin?




      1 user(s) are reading this topic

      0 members, 1 guests, 0 anonymous users