base: Fix broken IPython argument handling
authorAndreas Sandberg <andreas@sandberg.pp.se>
Sun, 10 Feb 2013 12:23:56 +0000 (13:23 +0100)
committerAndreas Sandberg <andreas@sandberg.pp.se>
Sun, 10 Feb 2013 12:23:56 +0000 (13:23 +0100)
Prior to this changeset, we used to clear sys.argv before entering the
IPython shell. This caused some versions of IPython to crash because
they assume argv[0] to exist. The correct way of overriding the
arguments passed to IPython is to set the argv keyword argument when
initializing the shell.

src/python/m5/main.py

index ce2979cd218d617fa1626aacb20aa83815af77e4..03fab990155a119861b4d0cd60a4b798ce23ca47 100644 (file)
@@ -129,10 +129,9 @@ def parse_options():
 
 def interact(scope):
     banner = "gem5 Interactive Console"
-    sys.argv = []
     try:
         from IPython.Shell import IPShellEmbed
-        ipshell = IPShellEmbed(banner=banner,user_ns=scope)
+        ipshell = IPShellEmbed(argv=[], banner=banner, user_ns=scope)
         ipshell()
     except ImportError:
         code.InteractiveConsole(scope).interact(banner)