Skip to content

Commit

Permalink
In theory, this fixes index loading
Browse files Browse the repository at this point in the history
  • Loading branch information
samhaswon committed Mar 7, 2024
1 parent 42b5663 commit 08ef4d4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/multi_bible_search/bible_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
import bz2
from collections import Counter
import json
import os
from typing import List


class BibleSearch(object):
def __init__(self, debug=False):
try:
with bz2.open("src/multi_bible_search/bible_index.json.pbz2", "rt", encoding='utf-8')as data_file:
self.__search_index = json.load(data_file)
except FileNotFoundError:
with bz2.open("../src/multi_bible_search/bible_index.json.pbz2", "rt", encoding='utf-8') as data_file:
self.__search_index = json.load(data_file)
base_path = os.path.dirname(os.path.abspath(__file__))

with bz2.open(f"{base_path}/bible_index.json.pbz2", "rt", encoding='utf-8')as data_file:
self.__search_index = json.load(data_file)
if debug:
print("Search index loaded")

Expand Down

0 comments on commit 08ef4d4

Please sign in to comment.