What user do python scripts run as in windows? [duplicate]

We’ve had issues removing files and directories on Windows, even if we had just copied them, if they were set to ‘readonly’. shutil.rmtree() offers you sort of exception handlers to handle this situation. You call it and provide an exception handler like this: import errno, os, stat, shutil def handleRemoveReadonly(func, path, exc): excvalue = exc[1] … Read more

Checking file/folder access permission

First of all, I would manually check the permissions and see what blocks you and what doesn’t. I am using something like this to check for permissions (for copy file): AuthorizationRuleCollection acl = fileSecurity.GetAccessRules(true, true,typeof(System.Security.Principal.SecurityIdentifier)); bool denyEdit = false; for (int x = 0; x < acl.Count; x++) { FileSystemAccessRule currentRule = (FileSystemAccessRule)acl[x]; AccessControlType accessType … Read more

Laravel daily log created with wrong permissions

Laravel version 5.6.10 and later has support for a permission element in the configuration (config/logging.php) for the single and the daily driver: ‘daily’ => [ ‘driver’ => ‘daily’, ‘path’ => storage_path(‘logs/laravel.log’), ‘level’ => ‘debug’, ‘days’ => 7, ‘permission’ => 0664, ], No need to juggle with Monolog in the bootstrap script. Specifically, support was added … Read more

How to restore the permissions of files and directories within git if they have been modified?

Git keeps track of filepermission and exposes permission changes when creating patches using git diff -p. So all we need is: create a reverse patch include only the permission changes apply the patch to our working copy As a one-liner: git diff -p -R –no-ext-diff –no-color \ | grep -E “^(diff|(old|new) mode)” –color=never \ | … Read more

file_put_contents – failed to open stream: Permission denied

Try adjusting the directory permissions. from a terminal, run chmod 777 database (from the directory that contains the database folder) apache and nobody will have access to this directory if it is chmodd’ed correctly. The other thing to do is echo “getcwd()”. This will show you the current directory, and if this isn’t ‘/something…/database/’ then … Read more

Windows 7, update.packages problem: “unable to move temporary installation”?

I found that the problem indeed is the antivirus “real time file system protection”. I do the following to fix the problem: trace(utils:::unpackPkgZip, edit=TRUE) I edit line 140 (line 142 in R 3.4.4): Sys.sleep(0.5) to: Sys.sleep(2) I seems like the antivirus stalls the creation of the package tmp dir. After changing it to 2 seconds … Read more