简体   繁体   English

Python 中的 Chmod - [Errno 1] 不允许操作

[英]Chmod in Python - [Errno 1] Operation not permitted

I'm trying to modify an application in my /Applications folder on OS X. I need to get read and write permissions, so I currently have:我正在尝试修改 OS X 上 /Applications 文件夹中的应用程序。我需要获得读写权限,因此我目前拥有:

os.chmod(appDir, 0644)

where appDir is the directory of my app.其中 appDir 是我的应用程序的目录。 However, whenever I run the program, I get the error:但是,每当我运行程序时,我都会收到错误消息:

OSError: [Errno 1] Operation not permitted: '/Applications/Simplenote.app'

I would try sudo , but how would you enter the password through Python?我会尝试sudo ,但是您将如何通过 Python 输入密码? (this is a Python script by the way) (顺便说一下,这是一个 Python 脚本)

Any help is appreciated.任何帮助表示赞赏。

If you are trying to run the script from a web site, change the target folders/files to be owned by the web user, eg www-data.如果您尝试从网站运行脚本,请将目标文件夹/文件更改为由网络用户拥有,例如 www-data。 sudo chown www-data * -R That fixed it for me. sudo chown www-data * -R为我解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python fcntl.ioctl [Errno 1] 不允许操作 - Python fcntl.ioctl [Errno 1] Operation not permitted OSError: [Errno 1] 不允许操作: - OSError: [Errno 1] Operation not permitted: OSError:[Errno 1]不允许操作 - OSError: [Errno 1] Operation not permitted 在 Mac 上的 python 中创建一个新的 .py 文件但得到 [Errno 1] 不允许操作 - Creating a new .py file in python on a mac but getting [Errno 1] Operation not permitted Python Celery init.d脚本OSError:[Errno 1]不允许操作 - Python Celery init.d script OSError: [Errno 1] Operation not permitted OSError:[Errno 1]在Mac上安装python quandl时不允许进行操作 - OSError: [Errno 1] Operation not permitted when installing python quandl on mac Dockerfile Raspberry PI Python pip install "PermissionError: [Errno 1] Operation not allowed" - Dockerfile Raspberry PI Python pip install "PermissionError: [Errno 1] Operation not permitted" Crontab 无法执行 python 脚本,错误:“[Errno 1] Operation not allowed” - Crontab can't execute python script with error: “[Errno 1] Operation not permitted” PermissionError:[Errno 1]写后读取时,Python中不允许进行此操作 - PermissionError: [Errno 1] Operation not permitted in Python while reading after write 在 mac 中安装 opencv-python 时,OSError: [Errno 1] Operation not allowed - When install opencv-python in mac, OSError: [Errno 1] Operation not permitted
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM