You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Python Ctrl-C stops the server fully. With Jython and IronPython stopping is initiated but the process doesn't return and there is a traceback on the console. The server exits if it is ever used again.
The problem is caused by differences in handling exceptions raised by signal handlers. With Python the exception we use breaks the loop in serve_forever, but with Jython and IronPython it is just logged to console. A fix is removing this hack solution and using timeout in handle_request inside the main loop.
The text was updated successfully, but these errors were encountered:
I was facing similar problem before in Jython. This is how I get it resolved.
First, register a signal handler in your Jython script by:
import signal
def intHandler(signum, frame):
print "Shutting down.."
System.exit(1)
# Set the signal handler
signal.signal(signal.SIGINT, intHandler)
signal.signal(signal.SIGTERM, intHandler)
This will register the signal handler for the Jython script to handle CTRL+C keyboard input.
However, the default console class org.python.util.JLineConsole treats ctrl+C as a normal character inputs.
So, Secondly - need to change the python.console to an alternative console class org.python.core.PlainConsole by either change the Jython property:
python.console=org.python.core.PlainConsole
or add the jvm argument:
-Dpython.console=org.python.core.PlainConsole
This will help you to shutdown the program after CTRL+C is pressed.
With Python Ctrl-C stops the server fully. With Jython and IronPython stopping is initiated but the process doesn't return and there is a traceback on the console. The server exits if it is ever used again.
The problem is caused by differences in handling exceptions raised by signal handlers. With Python the exception we use breaks the loop in serve_forever, but with Jython and IronPython it is just logged to console. A fix is removing this hack solution and using timeout in handle_request inside the main loop.
The text was updated successfully, but these errors were encountered: