Change current working directory in IPython (Windows)

I somehow cannot change the current working directory in IPython, and I have no idea why.

In the example below, I start IPython from the root of the C drive and try to change the current working directory in several ways. Weird result:

C:\>ipython
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 2.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython features.
%quickref -> Quick reference.
help      -> Python own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: cd
C:\Users\jkokorian

In [2]: %cd "C:\Dell"
C:\Dell

In [3]: cd
C:\Users\jkokorian

In [4]: import os

In [5]: os.chdir("C:\Dell")

In [6]: os.getcwd()
Out[6]: 'C:\\Dell'

In [7]: cd
C:\Users\jkokorian

In [8]: os.getcwd()
Out[8]: 'C:\\Users\\jkokorian'

Somehow, the working directory always binds to my home folder by default, even when IPython starts from the root of C :.

Does anyone know what is going on here?

+4
source share
1 answer

, "cd" magic - "C:\Users\jkokorian". , , , , .

+14

Source: https://habr.com/ru/post/1541093/


All Articles