From bdec1763b52208e20776d051544fd0dde8666d6e Mon Sep 17 00:00:00 2001 From: "Eryk J." <107011362+erykjj@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:32:09 -0400 Subject: [PATCH] Readd filepath dependency for resource resolution --- src/linkture/linkture.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/linkture/linkture.py b/src/linkture/linkture.py index 1f3acaa..a1fae3e 100755 --- a/src/linkture/linkture.py +++ b/src/linkture/linkture.py @@ -27,11 +27,12 @@ """ __app__ = 'linkture' -__version__ = 'v2.6.1' +__version__ = 'v2.6.2' import json, regex, sqlite3 import pandas as pd +from pathlib import Path from unidecode import unidecode @@ -66,9 +67,10 @@ def __init__(self, language='English', translate=None, form=None, separator=' ', else: form = 3 self._src_book_names = {} + path = Path(__file__).resolve().parent self._tr_book_names = ['Bible'] - con = sqlite3.connect('src/linkture/res/resources.db') + con = sqlite3.connect(path / 'res/resources.db') cur = con.cursor() for rec in cur.execute(f"SELECT * FROM Books WHERE Language = '{translate}';").fetchall(): if self._upper: @@ -83,7 +85,7 @@ def __init__(self, language='English', translate=None, form=None, separator=' ', item = unidecode(item) normalized = regex.sub(r'\p{P}|\p{Z}', '', item.upper()) self._src_book_names[normalized] = rec[2] - with open('src/linkture/res/custom.json', 'r', encoding='UTF-8') as json_file: + with open(path / 'res/custom.json', 'r', encoding='UTF-8') as json_file: b = json.load(json_file) if language in b.keys(): for row in b[language]: