>>> f = BloomFilter(max_elements=10_000_000, error_rate=0.02, filename=('/tmp/bloom.bin', -1))
>>> f.add('test')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "site-packages/bloom_filter/bloom_filter.py", line 560, in add
self.backend.set(bitno)
File "site-packages/bloom_filter/bloom_filter.py", line 113, in set
byte = ord(char)
TypeError: ord() expected string of length 1, but int found
In Python 3, indexing a
bytesobject givesint, there is no need to callord(). You can make the code compatible with both Python 2 and 3 by using a slice instead: