Question: I want to change os.path in `os.py`, but it failed. path is different in different platform.

`os.py`

```
import ntpath as path
sys.modules['os.path'] = path
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, devnull)

```

It turns out that

```
    from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
devnull)
ImportError: No module named path

```

Answer: 
Your approach should work. Rename the subdirectory `os` in your current directory to `my_os`. Python finds your `os` directory first and tries to import from there.

Adding this line:

```
__future__ import absolute_import

```

to the beginning of the `os.py` avoids this problem by using [absolute imports](https://docs.python.org/3.4/whatsnew/2.5.html?highlight=absolute%20import#pep-328).
did you try with "[\_\_import\_\_](https://docs.python.org/2/library/functions.html#__import__)" function ?

```
import mtpath as path
os_path = __import__(path, globals(), locals(), ['curdir', 'pardir', 'sep', 'pathsep', 'defpath', 'extsep', 'altsep', 'devnull']

```

Then, you can use 'curdir' as :

```
os_path.curdir

```

Well, you can also asign it to 'curdir' name as in the documentation :

```
curdir = os_path.curdir
pardir = os_path.curdir
…

```