OSError: [Error 1] Operation not permitted

前端 未结 4 1215
旧时难觅i
旧时难觅i 2020-12-06 19:29

I am trying to run a python script which uses a binary file (xFiles.bin.addr_patched) created by a postlinker. However, I am getting this error.

File \"abc.p         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 19:50

    Python code to change the permission:

    from getpwnam import pwd
    from getgrnam import grp
    import os
    
    uid = getpwnam("YOUR_USERNAME")[2]
    gid = grp.getgrnam("YOUR_GROUPNAME")[2]
    os.chown("myPath/xFiles.bin.addr_patched", uid, gid)
    

    Run the script with sudo and you're done.

提交回复
热议问题