+ Reply to Thread
Results 1 to 4 of 4

Thread: How to use python?

  1. #1
    the_king_dollars's Avatar
    the_king_dollars is offline x10 Sophmore the_king_dollars is an unknown quantity at this point
    Join Date
    Nov 2006
    Posts
    153

    Question How to use python?

    Can you tell me how to actually use python scripts? Please if you know tell me step by step.
    Thank you.

  2. #2
    t2t2t's Avatar
    t2t2t is offline x10 Elder t2t2t is an unknown quantity at this point
    Join Date
    Sep 2006
    Location
    Europe, Estonia
    Posts
    690

    Re: How to use python?

    Compile them with python?

    If you're gonna program with python, click this fat link .
    This post has been marked spam 52 times.


  3. #3
    the_king_dollars's Avatar
    the_king_dollars is offline x10 Sophmore the_king_dollars is an unknown quantity at this point
    Join Date
    Nov 2006
    Posts
    153

    Re: How to use python?

    Quote Originally Posted by t2t2t View Post
    Compile them with python?
    And how would I do that?

  4. #4
    noerrorsfound is offline x10 Elder noerrorsfound is an unknown quantity at this point
    Join Date
    Mar 2006
    Posts
    868

    Re: How to use python?

    Quote Originally Posted by the_king_dollars View Post
    And how would I do that?
    You don't. I don't know why he said that.

    Python is an interpreted language just like PHP, so you just upload the script in source form.

    Here is a very helpful response by Richard:
    Quote Originally Posted by Richard View Post
    Just a couple of things. When using python cgi you need to import the cgi module also because you are working with web documents you need to tell what type of document header it needs to use.

    So... The code will look as follows:
    Code:
    #!/usr/bin/env python
    
    import cgi
    
    print "Content-type: text/html"
    print
    print "Hello World"
    Line 1: The shebang (#!/usr/bin/env python) - this line uses the env command some times python is not installed in /usr/bin. This command looks in several location for a python installation.

    Line 3: Import the cgi module so that it can be use via the web.

    Line 5 + 6: Here we tell the browser that the page is text and formated as html the secont print command seperates the header from the reast of the script. With out it the script fails.

    Line 7: We print Hello World

    Using python out side cgi-bin

    If you want to use python files outside cgi-bin or use the .py file extention you need to goto Apache Handlers in cPanel can add .py (or any other extention) and cgi-script in the two boxes provided. This will allow you to execute cgi files anywhere on your site (BTW: .cgi is set by default).
    Edit: I noticed that I assumed you were talking about running Python scripts on your site. To run a Python script on your computer just make sure Python is installed and double click the script.
    Last edited by noerrorsfound; 12-20-2006 at 11:37 AM.
    EOF

+ Reply to Thread

Similar Threads

  1. ASP Support
    By __z|x__ in forum Feedback and Suggestions
    Replies: 46
    Last Post: 10-21-2006, 03:58 PM
  2. GML Tutorial?
    By Nate_Benton in forum Gamer's Lounge
    Replies: 11
    Last Post: 08-02-2006, 02:33 AM
  3. Python
    By TheJeffsta in forum Free Hosting
    Replies: 3
    Last Post: 04-09-2006, 08:04 AM
  4. does x10hosting support python?
    By moparfan90 in forum Free Hosting
    Replies: 3
    Last Post: 08-10-2005, 07:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers