From c4f24649359528c7566526fc218b4f2a07123028 Mon Sep 17 00:00:00 2001 From: Michal Masrna <38047051+michalmasrna1@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:01:08 +0100 Subject: [PATCH] fix: laws.py added missing import logging (#3501) ### What problem does this PR solve? _Choosing Laws Chunk Method results in an error when parsing a document. The error is caused by a missing import in the `laws.py` file._ ``` Traceback (most recent call last): File "/ragflow/rag/svr/task_executor.py", line 445, in handle_task do_handle_task(task) File "/ragflow/rag/svr/task_executor.py", line 384, in do_handle_task cks = build(r) ^^^^^^^^ File "/ragflow/rag/svr/task_executor.py", line 196, in build cks = chunker.chunk(row["name"], binary=binary, from_page=row["from_page"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ragflow/rag/app/laws.py", line 161, in chunk for txt, poss in pdf_parser(filename if not binary else binary, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/ragflow/rag/app/laws.py", line 124, in __call__ logging.debug("layouts:".format( ^^^^^^^ NameError: name 'logging' is not defined. Did you forget to import 'logging' ``` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): Co-authored-by: Michal Masrna --- rag/app/laws.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rag/app/laws.py b/rag/app/laws.py index 3334e9eba..a021e339f 100644 --- a/rag/app/laws.py +++ b/rag/app/laws.py @@ -10,6 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging from tika import parser import re from io import BytesIO