##// END OF EJS Templates
ipapi.get now returns None if there are no InteractiveShells running....
Brian Granger -
Show More
@@ -18,16 +18,19 b' has been made into a component, this module will be sent to deathrow.'
18 18 # Imports
19 19 #-----------------------------------------------------------------------------
20 20
21 from IPython.core.error import TryNext, UsageError
21 from IPython.core.error import TryNext, UsageError, IPythonCoreError
22 22
23 23 #-----------------------------------------------------------------------------
24 24 # Classes and functions
25 25 #-----------------------------------------------------------------------------
26 26
27
27 28 def get():
28 29 """Get the most recently created InteractiveShell instance."""
29 30 from IPython.core.iplib import InteractiveShell
30 31 insts = InteractiveShell.get_instances()
32 if len(insts)==0:
33 return None
31 34 most_recent = insts[0]
32 35 for inst in insts[1:]:
33 36 if inst.created > most_recent.created:
General Comments 0
You need to be logged in to leave comments. Login now