main: separate out interact() so it can be used by other functions
This commit is contained in:
parent
326adda5f3
commit
9d94d48a7d
1 changed files with 11 additions and 7 deletions
|
@ -128,6 +128,16 @@ if options_file:
|
|||
|
||||
arguments = options.parse_args()
|
||||
|
||||
def interact(scope):
|
||||
banner = "M5 Interactive Console"
|
||||
sys.argv = []
|
||||
try:
|
||||
from IPython.Shell import IPShellEmbed
|
||||
ipshell = IPShellEmbed(banner=banner,user_ns=scope)
|
||||
ipshell()
|
||||
except ImportError:
|
||||
code.InteractiveConsole(scope).interact(banner)
|
||||
|
||||
def main():
|
||||
import core
|
||||
import debug
|
||||
|
@ -349,13 +359,7 @@ def main():
|
|||
|
||||
# once the script is done
|
||||
if options.interactive:
|
||||
banner = "M5 Interactive Console"
|
||||
try:
|
||||
from IPython.Shell import IPShellEmbed
|
||||
ipshell = IPShellEmbed(banner=banner,user_ns=scope)
|
||||
ipshell()
|
||||
except ImportError:
|
||||
code.InteractiveConsole(scope).interact(banner)
|
||||
interact(scope)
|
||||
|
||||
if __name__ == '__main__':
|
||||
from pprint import pprint
|
||||
|
|
Loading…
Reference in a new issue