Commits

Grahack committed 13f5335

Use shutil.copyfile only if needed.

Comments (0)

Files changed (1)

                         func(f_src, f_dst)
                         break
                 else:
-                    shutil.copy(opj(cwd, f), opj(dir_out, cwd_site))
+                    src = opj(cwd, f)
+                    try:
+                        shutil.copy(src, opj(dir_out, cwd_site))
+                    except OSError:
+                        # some filesystems like FAT won't allow shutil.copy
+                        shutil.copyfile(src, opj(dir_out, cwd_site, f))
 
     pages.sort(key=lambda p: int(p.get("sval", "0")))