Sekhri Lotfi wrote:
> Hello,
>  I think that it doesn't work
> 
> here is my test:
> ---------------------------------------------------
> # server.py
> import web
> import sys
> 
> urls = (
> 
>   '/stopserver1', 'stopserver1',
> 
>   '/stopserver2','stopserver2')
> 
> class stopserver1:
>     def GET(self):
>         print "SERVER STOPPED 1 "
>         sys.exit()
> 
> class stopserver2:
>     def GET(self):
>         print "SERVER STOPPED 2 "
>         raise KeyboardInterrupt
> 
> web.webapi.internalerror = web.debugerror
> 
> if __name__ == "__main__": web.run(urls, globals(), web.reloader)
> ---------------------------------------------------
> 
> This is the error I get with sys.exit():
> ---------------------------------------------------
> Traceback (most recent call last):
>   File "/usr/lib/python2.5/site-packages/web.py-0.23-py2.5.egg/web/
> webapi.py", line 312, in wsgifunc
>     result = func()
>   File "/usr/lib/python2.5/site-packages/web.py-0.23-py2.5.egg/web/
> request.py", line 129, in <lambda>
>     func = lambda: handle(getattr(mod, name), mod)
>   File "/usr/lib/python2.5/site-packages/web.py-0.23-py2.5.egg/web/
> request.py", line 61, in handle
>     return tocall(*([x and urllib.unquote(x) for x in args] + fna))
>   File "/home/lotfi/Bureau/server.py", line 11, in GET
>     sys.exit()
> SystemExit
> 
> 127.0.0.1:58654 - - [01/Apr/2008 13:16:44] "HTTP/1.1 GET /stopserver1"
> - 200 OK
> 
> And this is the error I get with KeyboardInterrupt:
> --------------------------------------------------------------
> Traceback (most recent call last):
>   File "/usr/lib/python2.5/site-packages/web.py-0.23-py2.5.egg/web/
> webapi.py", line 312, in wsgifunc
>     result = func()
>   File "/usr/lib/python2.5/site-packages/web.py-0.23-py2.5.egg/web/
> request.py", line 129, in <lambda>
>     func = lambda: handle(getattr(mod, name), mod)
>   File "/usr/lib/python2.5/site-packages/web.py-0.23-py2.5.egg/web/
> request.py", line 61, in handle
>     return tocall(*([x and urllib.unquote(x) for x in args] + fna))
>   File "/home/lotfi/Bureau/server.py", line 16, in GET
>     raise KeyboardInterrupt
> KeyboardInterrupt
> 
> 127.0.0.1:58654 - - [01/Apr/2008 13:16:50] "HTTP/1.1 GET /stopserver2"
> - 200 OK
> 
> 
> Thanks For Help !!
> 
> 
> 
> 
> On 31 mar, 16:45, "Aaron Swartz" <[EMAIL PROTECTED]> wrote:
>> sys.exit() might work.
>>
>> Also, maybe:
>>
>> raise KeyboardInterrupt
> > 
> 

I smell a "wildcard-except:" and use of the traceback module... that 
explains how you can get those pretty formatted error messages even when 
there's a syntax error in the code. Am I right?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to