-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permission denied when copying a template from a read-only path #1292
Comments
Hmm, I'm not sure how we should deal with this either. That said, it is reasonable to expect that a user could have read-only permissions to any files in site-packages. For example, on a system with multiple users, only the root user might have write access to site-packages and therefore permission to install/update Python libs. Just because the user running MkDocs isn't the root user shouldn't mean they can't have access to all of MkDocs' features. So, yeah, this is a bug. As a workaround, you could create a virtualenv with your user account and install MkDocs in there. Then you would have full access. You just need to remember to "activate" the venv before running MkDocs. Actually, I always run MkDocs from a venv; I don't even have it installed as a system Python lib. |
So, it appears that the problem is that we use shutil.copy rather than shutil.copyfile. The difference is that |
Yes, looks like you are right. 👍 |
In various stages of a build, a new file may overwrite a previously written file (for example to override a theme). If a source file is read-only, the copied file cannot remain read-only. Therefore, permissions must not be copied with a file. `shutil.copyfile` only copies a file's contents and is now being used to copy all files. Fixes mkdocs#1292.
In various stages of a build, a new file may overwrite a previously written file (for example to override a theme). If a source file is read-only, the copied file cannot remain read-only. Therefore, permissions must not be copied with a file. `shutil.copyfile` only copies a file's contents and is now being used to copy all files. Fixes mkdocs#1292.
In various stages of a build, a new file may overwrite a previously written file (for example to override a theme). If a source file is read-only, the copied file cannot remain read-only. Therefore, permissions must not be copied with a file. `shutil.copyfile` only copies a file's contents and is now being used to copy all files. Fixes #1292.
you should be the complete target file name for destination destination = pathdirectory + filename.* I use this code fir copy wav file with shutil :
|
There are two things uncommon about my setup that cause the error.
lib/python2.7/site-packages/mkdocs
) have mode 0444 (that is, read-only).theme_dir
set inmkdocs.yml
and I use it to overwrite one of the theme files, namelyjs/highlight.pack.js
.This is what I get:
What happens is, the built-in theme files get copied with their permissions preserved, so
site/js/highlight.pack.js
ends up having mode 0444. Next mkdocs tries to overwrite this file with the one from thetheme_dir
and at this pointshutil.copyfile
fails, because that’s how it works.I’m not really sure what to do with that. Probably, catching the exception and adjusting the permissions would make sense.
The text was updated successfully, but these errors were encountered: