Python mmap 'Permission denied' on Linux

后端 未结 4 1089
梦毁少年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:59

    Try setting the file mode to r+. That worked for me on Linux:

    mfd = os.open('BigFile', "r+")
    

    Then this worked for me as normal:

    mfile = mmap.mmap(mfd, 0)
    

提交回复
热议问题