fix bug chunking:expected string or bytes-like object (#7116)

… bytes-like object

### What problem does this PR solve?
fix bug #6990 internal server error ehile chunking:expected string or
bytes-like object
_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### 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: unknown <taoshi.ln@chinatelecom.cn>
This commit is contained in:
QuintinTao 2025-04-18 14:42:36 +08:00 committed by GitHub
parent b1798bafb0
commit 1b4016317e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -193,6 +193,9 @@ def chunk(filename, binary=None, from_page=0, to_page=10000000000,
if n in df.columns: if n in df.columns:
del df[n] del df[n]
clmns = df.columns.values clmns = df.columns.values
if len(clmns) != len(set(clmns)):
duplicates = [col for col in clmns if list(clmns).count(col) > 1]
raise ValueError(f"Duplicate column names detected: {set(duplicates)}")
txts = list(copy.deepcopy(clmns)) txts = list(copy.deepcopy(clmns))
py_clmns = [ py_clmns = [
PY.get_pinyins( PY.get_pinyins(