Python mmap 'Permission denied' on Linux

后端 未结 4 1171
梦毁少年i
梦毁少年i 2021-02-18 14:26

I have a really large file I\'m trying to open with mmap and its giving me permission denied. I\'ve tried different flags and modes to the os.open but its just not

4条回答
  •  不要未来只要你来
    2021-02-18 14:55

    The cross-platform call of mmap can be performed using access parameter:

    mfd = os.open('BigFile', os.O_RDONLY)
    mm = mmap.mmap(mfd, 0, access=mmap.ACCESS_READ)
    

    The mmap construction permissions should be synced with the file open permissions (both read, write, or read/write).

提交回复
热议问题