axiak / pybloomfiltermmap

Fast Python Bloom Filter using Mmap
http://axiak.github.com/pybloomfiltermmap/
MIT License
739 stars 137 forks source link

Apparently read-only BF files aren't allowed. #88

Open rsharris opened 5 years ago

rsharris commented 5 years ago

I'm using a package that uses pybloomfilter. That package is poorly documented and when I guess wrong at some command-line parameters it used pybloomfilter to start overwriting the test bloom filter file it had included in the package.

So after re-downloading the package, I disabled write access for the test files before trying again. This time I got the command-line parameters right, and it tried to use pybloomfilter to read the existing BF file.

But the open called from line 325 in pybloomfilter.pyx doesn't appear to give the caller any way to specify a read-only file. So in cinit at line 52 and/or line 57 and/or line 62 it decides the filemode is read-write. And then os.access (correctly) refuses to open the file, and the OSError("Insufficient permissions...") exception is raised.

Is a read-only BF an unanticipated use case?

mizvyt commented 4 years ago

Not supported as of the latest commits. Added as a feature in the following PRs quite a lengthy time ago: https://github.com/axiak/pybloomfiltermmap/pull/59 https://github.com/axiak/pybloomfiltermmap/pull/83

But since this repository seems to be unmaintained, try following the Python 3 fork: https://github.com/prashnts/pybloomfiltermmap3

I've raised an issue there and collectively we may be able to add this feature.