0

I am trying to find the equivalent to php's exit command to stop a page from loading. For example I have:

if(isset($_SESSION['username'])){

}
else{
    echo 'Your session has expired, please click <a href="https://dev.test.com/">here</a>';
    exit;
}

Notice the exit on the else claus..it will stop the rest of the page from loading.

Is there a way to do this in mod_pythong psp <% exit %>

Sys.exit(0) doesn't seem to work because now i get a HTTP 500 error, even though the logs

[Tue Mar 15 15:36:11 2011] [error] [client
    10.184.98.38] PythonHandler mod_python.psp:   File "/var/www/html/index.psp", line 38, in ?\n    sys.exit(0) [Tue Mar 15 15:36:11 2011] [error] [client
    10.184.98.38] PythonHandler mod_python.psp: SystemExit: 0

1 Answer 1

1

What about something like this, using sys.exit :

import sys
sys.exit(0)

The number passed to exit being the exit code -- generally, 0 when there is no error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.