Cd Command In Ipython Vs. Spyder
I know that many of the working directory prompts that work in IPython also work in Spyder as long as they're prefaced by %. For example, pwd and ls work in IPython, but to run t
Solution 1:
When you run %foo
, that command is run in a new shell instance running as its own process. When that shell exits, changes to its state (such as its working directory) are lost with it; they don't effect the parent Python process that spawned it.
This is the same as how running sh -c 'cd /'
doesn't change your current working directory in shell. (Indeed, running a new process as sh -c "$some_command"
is exactly how the standard-C library call system(some_command)
, and its Python equivalent os.system(some_command)
works).
Post a Comment for "Cd Command In Ipython Vs. Spyder"