~ipython-contrib/ipython/qt-frontend

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# assumes there is /tmp and /opt

def curpath():
    cwd = os.path.splitdrive(os.getcwd())[1].replace('\\','/')
    print cwd
    return cwd

import os
cd /
assert curpath() == '/'
%cd /tmp
assert curpath() == '/tmp'
pushd /opt
assert curpath() == '/opt'
popd
assert curpath() == '/tmp'