#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    30
    Rep Power
    11

    Question If you can have CGI with Python can you have HTML and Java Script, also??!!??


    If you can have CGI with Python can you have HTML and Java Script, also??!!??
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    30
    Rep Power
    11
    And if they do go with python why won't it work for me??!!!???
  4. #3
  5. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    I'm not 100% on what you're getting at reaper but... you can use Python CGI (tick that one off) to output HTML (and that one) and yes, even Javascript (a straight flush )

    Mark.
    programming language development: www.netytan.com Hula

  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    Originally Posted by reaper69
    And if they do go with python why won't it work for me??!!!???
    It would help if you could be more specific about exactly how it didn't work. What is the code you are trying to run? Was there an error message, either in the browser or in the server error log? Did your PC hang? Did it explode in a ball of flames?

    A CGI script runs on a server and returns a chunk of data to the browser. This is usually an HTML page, which can include Javascript just like a normal HTML page. The Javascript is run on the browser, and is totally separate from the CGI script. As far as the Python script is concerned it is just sending a stream of bytes.

    Here is a handy tip for CGI programming (for Python 2.2 onwards). If you add the following lines to the start of your CGI script then any exceptions that your script generates will be returned as nicely formatted HTML, with a complete traceback.

    Code:
    import cgitb
    cgitb.enable()
    You will only want to do this during development, since it is not something you will want your users to see. However you can configure the cgitb module to write the traceback to the error log instead. RTFM for more information.

    Hope this helps.

    Dave - The Developers' Coach

IMN logo majestic logo threadwatch logo seochat tools logo