1. Antoine Pitrou
  2. pathlib

Commits

Antoine Pitrou  committed 1438df2

Fix running under Windows with py 2.7.

  • Participants
  • Parent commits 4c0c41c
  • Branches default

Comments (0)

Files changed (1)

File pathlib.py

View file
  • Ignore whitespace
 except ImportError:
     nt = None
 else:
-    if sys.getwindowsversion()[:2] >= (6, 0):
+    if sys.getwindowsversion()[:2] >= (6, 0) and sys.version_info >= (3, 2):
         from nt import _getfinalpathname
     else:
         supports_symlinks = False
     rename = _wrap_binary_strfunc(os.rename)
 
     if nt:
-        symlink = _wrap_binary_strfunc(os.symlink)
+        if supports_symlinks:
+            symlink = _wrap_binary_strfunc(os.symlink)
+        else:
+            def symlink(a, b, target_is_directory):
+                raise NotImplementedError("symlink() not available on this system")
     else:
         # Under POSIX, os.symlink() takes two args
         @staticmethod