I didn't follow the thread, I am sorry if this is duplicate, but don't catch all Exceptions, catch only the ones you expect, so that you can identify unexpected errors: cookie = cookies.SimpleCookie( os.environ['HTTP_COOKIE'] ) try: cookieID = cookie['name'].value except KeyError: cookieID = 'visitor' -- http://ysar.net/