0

In the django tutorials the guy explains edit the setup.py with the following:

os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

Why do I need normpath here? Wouldn't it suffice to only use dirname?:

os.chdir(os.path.dirname(__file__))
  • See this http://stackoverflow.com/a/51523/4385913 or [this](http://stackoverflow.com/questions/17730173/python-cant-get-full-path-name-of-file) – Skizo-ozᴉʞS ツ Feb 13 '15 at 09:20

1 Answers1

0

Have a look in the documentation:

os.path.normpath(path)

Normalize a pathname by collapsing redundant separators and up-level references so that A//B, A/B/, A/./B and A/foo/../B all become A/B. This string manipulation may change the meaning of a path that contains symbolic links. On Windows, it converts forward slashes to backward slashes. To normalize case, use normcase().

Sebastian Stigler
  • 6,819
  • 2
  • 29
  • 31