Huanshere / Huanshere/VideoLingo

Bug: DataFrame creation fails due to mismatched array lengths in step5_splitforsub.py

Open
#369 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
18.5k
Forks
2k
Avg merge
7h 41m
Merged PRs (30d)
12

Description

你好,以下是我用 AI 生成的 issue 报告,谢谢开发者。

标题

Bug: DataFrame creation fails due to mismatched array lengths in step5_splitforsub.py

问题描述

在处理字幕分割时,程序在 step5_splitforsub.py 中创建 DataFrame 时报错,显示源文本和翻译文本的数组长度不匹配。

错误信息
2025-01-21 16:23:13.174 Uncaught app exception
Traceback (most recent call last):
File "/opt/anaconda3/envs/videolingo/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
result = func()
File "/opt/anaconda3/envs/videolingo/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 590, in code_to_exec
exec(code, module. dict )
File "/Users/XXX/NAS-Home/Document/Code/Github-开源项目/VideoLingo/st.py", line 123, in
main()
File "/Users/XXX/NAS-Home/Document/Code/Github-开源项目/VideoLingo/st.py", line 119, in main
text_processing_section()
File "/Users/XXX/NAS-Home/Document/Code/Github-开源项目/VideoLingo/st.py", line 33, in text_processing_section
process_text()
File "/Users/XXX/NAS-Home/Document/Code/Github-开源项目/VideoLingo/st.py", line 57, in process_text
step5_splitforsub.split_for_sub_main()
File "/Users/XXX/NAS-Home/Document/Code/Github-开源项目/VideoLingo/core/step5_splitforsub.py", line 131, in split_for_sub_main
pd.DataFrame({'Source': src, 'Translation': remerged}).to_excel(OUTPUT_REMERGED_FILE, index=False)
File "/opt/anaconda3/envs/videolingo/lib/python3.10/site-packages/pandas/core/frame.py", line 778, in init mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy, typ=manager)
File "/opt/anaconda3/envs/videolingo/lib/python3.10/site-packages/pandas/core/internals/construction.py", line 503, in dict_to_mgr
return arrays_to_mgr(arrays, columns, index, dtype=dtype, typ=typ, consolidate=copy)
File "/opt/anaconda3/envs/videolingo/lib/python3.10/site-packages/pandas/core/internals/construction.py", line 114, in arrays_to_mgr
index = _extract_index(arrays)
File "/opt/anaconda3/envs/videolingo/lib/python3.10/site-packages/pandas/core/internals/construction.py", line 677, in _extract_index
raise ValueError("All arrays must be of the same length")
ValueError: All arrays must be of the same length
复现步骤
  1. 启动 VideoLingo
  2. 上传视频并完成翻译
  3. 在字幕处理阶段出现错误
环境信息
  • Python 版本:3.10
  • 操作系统:macOS
  • VideoLingo 版本:[您的版本号]
建议修复

建议在创建 DataFrame 之前添加数组长度检查,确保 srcremerged 数组长度一致。可以考虑在 split_align_subs 函数中添加数据一致性验证。

相关文件
  • core/step5_splitforsub.py

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in core/step5_splitforsub.py at line 131, where split_for_sub_main creates the DataFrame, then inspect the split_align_subs path that produces src and remerged. Reproduce the subtitle-processing workflow from the issue and compare the two array lengths before DataFrame creation. Done means the reported workflow no longer raises the mismatched-length error and the resulting output remains aligned.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python, streamlit
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.