Skip to content

fail to copy (again) read-only files #375

Closed
@zacchiro

Description

@zacchiro

Heya, I'm transferring files to the gallery using the files_to_copy setting, and some of them are read-only (as in, e.g., chmod 444). All goes well at the first run of sigal to build the gallery, but subsequent ones fail with:

Traceback (most recent call last):
  File "/home/zack/.virtualenvs/bici/bin/sigal", line 10, in <module>
    sys.exit(main())
  File "/home/zack/.virtualenvs/bici/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/zack/.virtualenvs/bici/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/zack/.virtualenvs/bici/lib/python3.5/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/zack/.virtualenvs/bici/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/zack/.virtualenvs/bici/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/zack/.virtualenvs/bici/lib/python3.5/site-packages/sigal/__init__.py", line 148, in build
    copy(src, dst, symlink=settings['orig_link'])
  File "/home/zack/.virtualenvs/bici/lib/python3.5/site-packages/sigal/utils.py", line 50, in copy
    func(src, dst)
  File "/home/zack/.virtualenvs/bici/lib/python3.5/shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/zack/.virtualenvs/bici/lib/python3.5/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'DESTINATION PATH SNIPPED'

Removing the file does work (because the dir containing them is writable), but I'm not sure you'd want to systematically try to remove existing destination files before copying them over. Not sure what would be a better fix either though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions