Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update table.py to convert clmns to string #414

Merged
merged 2 commits into from
Apr 17, 2024
Merged

Conversation

yc-huang
Copy link
Contributor

@yc-huang yc-huang commented Apr 17, 2024

What problem does this PR solve?

When handling some excel file, following error might occur, looks like some clmns item could be in type 'int':

[INFO] [2024-04-17 16:01:40,644] [_internal._log] [line:96]: 172.29.0.6 - - [17/Apr/2024 16:01:40] "GET /v1/document/list?kb_id=615d3698fc6711ee85920242ac140006&page=1&page_size=10 HTTP/1.1" 200 - Traceback (most recent call last):
File "/ragflow/rag/svr/task_executor.py", line 130, in build
cks = chunker.chunk(row["name"], binary=binary, from_page=row["from_page"],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ragflow/rag/app/table.py", line 198, in chunk
py_clmns = [
^
File "/ragflow/rag/app/table.py", line 200, in
re.sub(
File "/root/miniconda3/envs/py11/lib/python3.11/re/init.py", line 185, in sub
return _compile(pattern, flags).sub(repl, string, count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'int'

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

to avoid error like following:

[INFO] [2024-04-17 16:01:40,644] [_internal._log] [line:96]: 172.29.0.6 - - [17/Apr/2024 16:01:40] "GET /v1/document/list?kb_id=615d3698fc6711ee85920242ac140006&page=1&page_size=10 HTTP/1.1" 200 -
Traceback (most recent call last):
  File "/ragflow/rag/svr/task_executor.py", line 130, in build
    cks = chunker.chunk(row["name"], binary=binary, from_page=row["from_page"],
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ragflow/rag/app/table.py", line 198, in chunk
    py_clmns = [
               ^
  File "/ragflow/rag/app/table.py", line 200, in <listcomp>
    re.sub(
  File "/root/miniconda3/envs/py11/lib/python3.11/re/__init__.py", line 185, in sub
    return _compile(pattern, flags).sub(repl, string, count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'int'
rag/app/table.py Outdated Show resolved Hide resolved
@KevinHuSh KevinHuSh merged commit e8570da into infiniflow:main Apr 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants