I'm trying to mmap a file like this:
f= open('file.txt', 'r')
data= mmap.mmap(f.fileno(), 0)
But I get:
data= mmap.mmap(f.fileno(), 0)
ValueError: mmap offset is greater than file size
After searching for this, I still can't figure out what's wrong and the weird thing is, this was working half an hour ago! Any help?
I am moving this from my comment, as it was helpful to OP..
You need to check whether your file is empty.. mmap.mmap
throws exception, if the file in the parameter is empty..
Check the documentation -> http://docs.python.org/library/mmap.html