Commits

Lukasz Balcerzak committed 28497d6

Fixed import_media command under Windows issue

Comments (0)

Files changed (1)

richtemplates/management/helpers.py

 import logging
 
 from django.core.management.base import _make_writeable, CommandError
-from shutil import copy2, copystat, Error, WindowsError
+from shutil import copy2, copystat, Error
 from richtemplates.extras.progressbar import ProgressBar
 
 def copy_dir_helper(src, dst, force=False):
     try:
         copystat(src, dst)
     except OSError, why:
+        try:
+            from shutil import WindowsError
+            WindowsError # For pylint
+        except ImportError:
+            WindowsError = None
         if WindowsError is not None and isinstance(why, WindowsError):
             # Copying file access times may fail on Windows
             pass