File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 27
27
STDOUT_LEVEL = 25 # between INFO (20) and WARNING (30)
28
28
STDERR_LEVEL = 35 # between WARNING (30) and ERROR (40)
29
29
30
+ class StopExecutionException (Exception ):
31
+ pass
32
+
33
+ class TerminalInteractiveShell (IPython .terminal .interactiveshell .TerminalInteractiveShell ):
34
+ def _showtraceback (self , etype , evalue , stb ):
35
+ if isinstance (evalue , StopExecutionException ):
36
+ _logger .warning ("Execution stopped programmatically by calling stop_execution()" )
37
+ return None
38
+ super ()._showtraceback (etype , evalue , stb )
39
+
40
+ def stop_execution ():
41
+ raise StopExecutionException ()
42
+
30
43
def enable_autoreload ():
31
44
ipython = IPython .get_ipython ()
32
45
ipython .magic ("load_ext autoreload" )
Original file line number Diff line number Diff line change 6
6
from omnetpp .scave .analysis import *
7
7
from omnetpp .scave .results import *
8
8
9
+ from inet .common import *
9
10
from inet .project .omnetpp import *
10
11
from inet .simulation import *
11
12
from inet .test import *
@@ -38,6 +39,7 @@ def run_repl_main():
38
39
else :
39
40
_logger .info ("OMNeT++ Python support is loaded." )
40
41
app = IPython .terminal .ipapp .TerminalIPythonApp .instance ()
42
+ app .interactive_shell_class = TerminalInteractiveShell
41
43
app .display_banner = False
42
44
app .exec_lines = ["from inet import *" , "enable_autoreload()" , "register_key_bindings()" ]
43
45
app .initialize (argv = [])
You can’t perform that action at this time.
0 commit comments