+ Reply to Thread
Results 1 to 2 of 2

Thread: Python troubles

  1. #1
    radford.will70 is offline x10Hosting Member radford.will70 is an unknown quantity at this point
    Join Date
    Jun 2010
    Posts
    1

    Question Python troubles

    I've set permissions in folders scgi-bin and cgi-bin.

    I uploaded testing.py to both folders.

    I've tried the htaccess handler in both folders with the internal error 500 message.
    Code:
    AddHandler cgi-script .py
    I've used a very simple script, an example from these forums that was stated to work.
    Code:
    print("Content-type: text/html")
    print("")
    
    print("<html>")
    print("<body>")
    
    print( "Hi there")
    
    print("</body>")
    print("</html>")

    I get the script outputting the whole script's code line by line but never the processed code.

    Is there something obvious I'm doing wrong? It's a "free" account at x10hosting, does that matter or do all accounts have access to python and cgi?

    Thanks in advance.

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Python troubles

    You only need an AddHandler directive outside of cgi-bin (and scgi-bin, if it's already configured with a ScriptAlias directive). What you're missing is a shebang line. Add:
    Code:
    #!/usr/bin/python
    to the start of the script. Also check that the script has execute permissions, that you upload it in ASCII mode, and that your editor doesn't insert a byte order mark. A bit of searching should have turned this up.
    Last edited by misson; 06-19-2010 at 11:31 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. troubles
    By godofwar1 in forum Free Hosting
    Replies: 4
    Last Post: 05-02-2010, 02:50 PM
  2. cgi troubles
    By anomaly in forum Programming Help
    Replies: 1
    Last Post: 06-29-2008, 03:16 PM
  3. <div> Troubles
    By Penguin129 in forum Programming Help
    Replies: 9
    Last Post: 01-02-2008, 11:16 AM
  4. Ad troubles =3
    By butter_wing in forum Free Hosting
    Replies: 5
    Last Post: 12-14-2006, 05:49 PM

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