运行Python脚本以覆盖主机文件时获得“权限被拒绝”

时间:2016-12-12 19:06:04

标签: python

当我运行Python脚本来编辑主机文件时,我收到此错误:

Traceback (most recent call last):   File"/Users/tom/Documents/Udemy/Python Mega Course/Website_Blocker_App3.py", line 15, in <module>     with open( host_path, 'r+') as file: PermissionError: [Errno 13] Permission denied: '/etc/hosts'

我有一台Mac OS X,我已经尝试过启用root用户权限,但它似乎没有用。

0 个答案:

没有答案