I try to load a file in memory with this:
import mmap
with open(path+fileinput+'example.txt', 'rb') as f:
fileinput = mmap.mmap(f.fileno(), 0, prot=mmap.PROT_READ)
When I run the code the error:
AttributeError: 'module' object has no attribute 'PROT_READ'
The PROT_READ
and PROT_WRITE
are Unix-specific. You're likely looking for:
mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
The mmap
page actually has different entries for Unix/Windows version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With