View Poll Results: Do you use Python on a powweb hosted site?

Voters
3. You may not vote on this poll
  • Always

    1 33.33%
  • Sometimes

    1 33.33%
  • Not yet

    0 0%
  • Never will

    1 33.33%
Results 1 to 5 of 5

Thread: Python Error Reporting

  1. #1
    Registered
    Join Date
    Sep 2009
    Location
    Oakley, CA
    Posts
    7
    Rep Power
    0

    Python Error Reporting

    I am trying to get errors from my python script without any luck. It just dies and reports

    "The server encountered an unexpected condition which prevented it from fulfilling the request. The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log. "

    If I send the content type headers in advance it seems to just die quietly.

    UPDATE: I thought I would add this comment here in case someone else or me finds it again wondering how to print python errors.

    PHP Code:

    import sys
    traceback
    tb 
    "no errors"
    try:
        
    """do something here that raises an exception"""
    except Exception as e:
        
    tb traceback.format_exc()
    finally:
        print 
    """Content-Type: text/plain; charset=utf8\n\n%s""" % (tb,) 

  2. #2
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    Not in Solomons anymore.
    Posts
    3,434
    Rep Power
    21
    You can check script error logs in OPS - CGI Error Logs
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  3. #3
    Registered
    Join Date
    Sep 2009
    Location
    Oakley, CA
    Posts
    7
    Rep Power
    0
    neat, thanks! how did you find this?

    short of having shell access and running tail on the actual log, this is divine.

    btw, do you happen to know where this log is located?

  4. #4
    Registered
    Join Date
    Sep 2009
    Location
    Oakley, CA
    Posts
    7
    Rep Power
    0
    yes. this rocks. thanks.

  5. #5
    Thinkin' out loud again Builder's Avatar
    Join Date
    Nov 2002
    Location
    Illinois
    Posts
    2,088
    Rep Power
    19
    Quote Originally Posted by shanimal View Post
    btw, do you happen to know where this log is located?
    In your /stats/ folder, same level as htdocs. cgi_error_log is the file name (no extension) and can be viewed in a text editor.

    Good luck!
    Kevin
    A good friend will come and bail you out of jail...
    but a true friend will be sitting next to you saying,
    "Damn... that was fun!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •