Print recent CGI error

G

Gnarlodious

I have a serious error that causes the process to crash. Apache
refuses to log the error and it only happens on the server, not on the
dev machine. Problem is, I can't figure out how to get the most recent
error. I can find all sorts of pages telling how to print a specific
error, but how to get an unknown error:

Here is where I am:

NowCookie.load(savedCookie)
try:
savedCookie=NowCookie['Sectrum'].value # PROCESS CRASHES HERE
except:
print("Content-type:text/html\n\n")
print("???") # PRINT WHATEVER ERROR OCCURRED
quit()

There must be something so simple I am missing...

This is Python 3.

-- Gnarlie
 
D

Dan Stromberg

I've sometimes got similar situations in CGI, that turned out to be
because of a syntax error that kept apache from being able to run the
script. What if you just run the script at the command line? It
should either error out due to lack of a CGI environment/arguments,
but hopefully it'll give you an error message that'll be useful.
Also, you might be able to get some mileage out of finding out what
env vars and command line options are being passed, and running from
the command line with those.
 
M

MRAB

I have a serious error that causes the process to crash. Apache
refuses to log the error and it only happens on the server, not on the
dev machine. Problem is, I can't figure out how to get the most recent
error. I can find all sorts of pages telling how to print a specific
error, but how to get an unknown error:

Here is where I am:

NowCookie.load(savedCookie)
try:
savedCookie=NowCookie['Sectrum'].value # PROCESS CRASHES HERE
except:
print("Content-type:text/html\n\n")
print("???") # PRINT WHATEVER ERROR OCCURRED
quit()

There must be something so simple I am missing...

This is Python 3.
You could try something like:

import traceback

NowCookie.load(savedCookie)
try:
savedCookie=NowCookie['Sectrum'].value # PROCESS CRASHES HERE
except:
print("Content-type:text/html\n\n")
traceback.print_exception(*sys.exc_info()) # PRINT WHATEVER ERROR
OCCURRED
quit()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top