+ Reply to Thread
Results 1 to 7 of 7

Thread: Python script simply won't run!

  1. #1
    matrixsquare is offline x10Hosting Member matrixsquare is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    4

    Python script simply won't run!

    Okay, so I made a helloworld.py file and uploaded it into my cgi-bin folder:
    #!#!/usr/bin/python

    print "Content-Type: text/html"
    print
    print """\
    <html>
    <body>
    <h2>Hello World!</h2>
    </body>
    </html>
    """
    Looks fine, right? Right. I change the permission to 755 as any sane individual world. Lo and behold, I point my browser to http://mse.x10hosting.com/cgi-bin/helloworld.py and it immediately returns an Internal Server Error 500.

    I also tweaked the .htaccess file a bit so that .py files can be run anywhere, my .htaccess file now looks like:
    # -FrontPage-

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName mse.x10hosting.com
    AuthUserFile /home/mse/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/mse/public_html/_vti_pvt/service.grp
    Options +ExecCGI
    AddType application/x-httpd-cgi .pl
    AddHandler cgi-script .py
    The new additions are bolded.

    I'm at my wits' end, why the heck is this happening? And more importantly: Is there a solution (there HAS to be! Other users are using Python with x10hosting perfectly fine!)

    Thanks in advance for any help, guys .
    Edit:
    Hahahaha, I'm laughing my butt off right now... My python scripts will run anywhere BUT in the cgi-bin folder!

    Man, who the heck set up Python for these servers :nuts:?

    Either way, I'm happy, since I can at least use Python now !
    Last edited by matrixsquare; 03-30-2009 at 03:14 AM. Reason: Automerged Doublepost

  2. #2
    marzipun is offline x10Hosting Member marzipun is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    2

    Re: Python script simply won't run!

    Well now, sir, if it wasn't for your first line:-

    #!#!/usr/bin/python

    I'd think you were a genius.

    I know... I know... you were just checking that we were awake.

  3. #3
    matrixsquare is offline x10Hosting Member matrixsquare is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    4

    Re: Python script simply won't run!

    Quote Originally Posted by marzipun View Post
    Well now, sir, if it wasn't for your first line:-

    #!#!/usr/bin/python

    I'd think you were a genius.

    I know... I know... you were just checking that we were awake.
    Interesting, I think I was about to type out my script and started with "#!" when I decided to simply copy and paste.

    There isn't the double #! in the shebang header in the actual script file (I just double checked).

    Also, just for future reference for other people who may run into this problem, I use THIS for the shebang line instead of #!/usr/bin/python:
    #!/usr/bin/env python

    That should look in the entire environment directory for a runnable python installation; so my guess is that python isn't actually installed in usr/bin/python directory...

    Either way, the fact that python scripts doesn't run in the CGI-Bin folder (but runs anywhere else) is still pretty hilarious :laugh:.

  4. #4
    marzipun is offline x10Hosting Member marzipun is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    2

    Re: Python script simply won't run!

    Now I think you are a genius. Thanks.

  5. #5
    maisouimail is offline x10Hosting Member maisouimail is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    1

    Re: Python script simply won't run!

    Very good work, guys! This was 100% what I needed to know.

    This was my first visit to the forums to get help (I am a new user), and I am delighted to see that there are sensible and witty people already here who have built up a useful and friendly community.

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

    Re: Python script simply won't run!

    Quote Originally Posted by matrixsquare View Post
    Either way, the fact that python scripts doesn't run in the CGI-Bin folder (but runs anywhere else) is still pretty hilarious :laugh:.
    Python scripts in cgi-bin run for me on Absolut. Which host is your site on?

  7. #7
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: Python script simply won't run!

    The same script didn't work for me on Stoli.

    And I believe you wanted to have
    Code:
    AddType application/x-httpd-cgi .py
    instead of
    Code:
    AddType application/x-httpd-cgi .pl
    Last edited by xav0989; 04-01-2009 at 08:45 AM.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

+ Reply to Thread

Similar Threads

  1. [OFF] selling some hot script 500 credits each
    By neteater in forum The Marketplace
    Replies: 8
    Last Post: 03-24-2009, 09:08 PM
  2. Access to 300+ PHP scripts (2500 credits)
    By jonathanyaniv in forum The Marketplace
    Replies: 11
    Last Post: 06-03-2008, 10:58 PM
  3. Replies: 3
    Last Post: 04-03-2008, 04:47 PM
  4. Replies: 8
    Last Post: 12-03-2007, 04:12 PM
  5. Server UP time Script
    By dharmil in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 04-03-2006, 04:39 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