Skip to content

Commit

Permalink
not rely on __file__
Browse files Browse the repository at this point in the history
  • Loading branch information
Snoopy1866 committed Oct 15, 2024
1 parent 6ca14b6 commit 7f05775
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sphinx/search/zh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import inspect
import os
import re

Expand Down Expand Up @@ -235,7 +236,7 @@ def __init__(self, options: dict[str, str]) -> None:
def init(self, options: dict[str, str]) -> None:
if JIEBA:
default_dict_path = os.path.join(
os.path.dirname(jieba.__file__), 'dict.txt'
os.path.dirname(inspect.getfile(jieba)), jieba.DEFAULT_DICT_NAME
)
dict_path = options.get('dict', default_dict_path)
if dict_path and os.path.isfile(dict_path):
Expand Down

0 comments on commit 7f05775

Please sign in to comment.