##// END OF EJS Templates
inputhook: disable CTRL+C when a hook is active....
inputhook: disable CTRL+C when a hook is active. On systems with 'readline', it's very likely to intercept a signal during a select() call. The default SIGINT handler will schedule a KeyboardInterrupt exception to be raised as soon as possible. If ctypes is used to install a Python callback for PyOS_InputHook, this will happen as soon as the bytecode execution starts, so even if the first instruction of the callback is a `try: ... except KeyboardInterrupt` clause, it's actually too late. As ctypes doesn't allow a Python callback to raise an exception, this ends up with IPython detecting an internal error... not pretty. We must therefore ignore the SIGINT signals until we are sure the exception handler is active, in the Python callback.

File last commit:

r2267:928c921b
r4944:0fc80df3
Show More
ipy_profile_numpy.py
24 lines | 524 B | text/x-python | PythonLexer
""" IPython 'numpy' profile, to preload NumPy.
This profile loads the math/cmath modules as well as all of numpy.
It exposes numpy via the 'np' shorthand as well for convenience.
"""
from IPython.core import ipapi
import ipy_defaults
def main():
ip = ipapi.get()
try:
ip.ex("import math,cmath")
ip.ex("import numpy")
ip.ex("import numpy as np")
ip.ex("from numpy import *")
except ImportError:
print "Unable to start NumPy profile, is numpy installed?"
main()