The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Python not working

Discussion in 'General Discussion' started by mail2sacp, Nov 21, 2008.

  1. mail2sacp

    mail2sacp Well-Known Member

    Joined:
    Feb 25, 2007
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    I have following python file which is not working. Please let me know what should I do to run this file.

    --------------------------------
    #!/usr/bin/python
    def index():
    s = """\
    <html>
    <body>
    <h2>Hello World!</h2>
    </body>
    </html>
    """
    return s
    ---------------------------------

    I have python installed on /usr/bin/python properly.

    Regards
    mail2sacp
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    To help others assist you with this issue, can you elaborate on what you mean by "not working?"

    Is it displaying the source code instead of executing it. Or is the script being executed and generating an Internal Server 500 message? Or something else?
     
  3. mail2sacp

    mail2sacp Well-Known Member

    Joined:
    Feb 25, 2007
    Messages:
    71
    Likes Received:
    0
    Trophy Points:
    6
    Hi David,

    yes its showing the source code in browser.

    What should be done?
     
  4. minotauro

    minotauro Well-Known Member

    Joined:
    Jan 19, 2004
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    6
    Hello David,

    To me, displaying the source code. :confused:

    Thank you,
    Minotauro.
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Is this a .cgi file with executable permissions?
     
  6. minotauro

    minotauro Well-Known Member

    Joined:
    Jan 19, 2004
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    6
    Hello David,

    My file is a .py extension.

    Thank you,
    Minotauro.
     
  7. apscinsspl

    apscinsspl Well-Known Member

    Joined:
    Mar 15, 2008
    Messages:
    112
    Likes Received:
    0
    Trophy Points:
    16
    .py does not work if its mod python installed , so you need to run the python script as .cgi or .pl
     
  8. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    An unsupported EasyApache module for implementing mod_Python is available at:

    http://easyapache.cPanel.net

    These modules are unsupported and come with a "use at your own risk" warning.
     
  9. minotauro

    minotauro Well-Known Member

    Joined:
    Jan 19, 2004
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    6
    Hello apscinsspl and cPanelDavidG,

    Very thank you by information! :)

    Regards,
    Minotauro.
     
Loading...

Share This Page