I’m on Windows and I have created a virtualenv sandbox. I activate the sandbox and now I want to start up an IPython shell using the sandboxed environment. The following will do just that.

python -c "import IPython.Shell; IPython.Shell.IPShell().mainloop(sys_exit=1)"

thx to ThomasWaldmann on #python

Update: I thought I was doing something wrong. I would execute the command listed above and then do a ls and I would get a DOS command prompt instead of executing an aliased DIR and an error message. One of the additional things was that I was doing this inside TakeCommand; in a TCC shell. I executed an exit and it returned to the IPython Shell.

It turns out that the command wasn’t successfully executing because the environmental variable COMSPEC was set to C:\Program Files\JPSoft\TCMD10\TCC.EXE. This includes a space and I thought that might be the cause of the problem. It turns out I was right.

If, before I execute the python command, I set the environmental variable COMSPEC to C:\PROGRA~1\JPSoft\TCMD10\tcc.exe, then all is well.

  • To use ipython 'inside' sandbox on linux you can use alias:
    alias ipython="/usr/bin/env python `which ipython`"
blog comments powered by Disqus

Powered by Web Design Company Plugins