Skip to content

fix: add missing numpy import in _11_merge_audio.py#550

Open
wearshoes wants to merge 1 commit intoHuanshere:mainfrom
wearshoes:fix/np-not-defined-merge-audio
Open

fix: add missing numpy import in _11_merge_audio.py#550
wearshoes wants to merge 1 commit intoHuanshere:mainfrom
wearshoes:fix/np-not-defined-merge-audio

Conversation

@wearshoes
Copy link
Copy Markdown

Summary

  • Add import numpy as np to core/_11_merge_audio.py to fix NameError: name 'np' is not defined during audio merging

Problem

_10_gen_audio.py saves new_sub_times to Excel with np.float64 values. When serialized to string, they become np.float64(16.496). _11_merge_audio.py uses eval() to parse these strings but doesn't import numpy, causing:

Starting audio merging process...
NameError: name 'np' is not defined

Root Cause

In _11_merge_audio.py:22, eval() is called on strings like [[np.float64(16.496), np.float64(19.116)]] but np (numpy) is not in scope.

Fix

Add import numpy as np at the top of core/_11_merge_audio.py.

Fixes #543
Fixes #544

Test plan

  • Reproduced the error locally
  • Applied fix and verified audio merging + video generation completes successfully

The `load_and_flatten_data` function uses `eval()` to parse
`new_sub_times` from Excel. When `_10_gen_audio.py` writes
`np.float64` values, they serialize as `np.float64(...)` strings.
Without `import numpy as np`, `eval()` raises
`NameError: name 'np' is not defined`.

Fixes Huanshere#543
Fixes Huanshere#544
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.

到语音合成环节就会出现❌ 任务出错: name 'np' is not defined name 'np' is not defined

1 participant