#5542 AttributeError: 'NoneType' object has no attribute 'keys'

108.160* Posted at: 1 hour ago

Traceback (most recent call last):
File "/Users/username/pyvideotrans/videotrans/mainwin/_actions.py", line 246, in tts_type_change

self.main.current_rolelist = list(rolelist.keys())

AttributeError: 'NoneType' object has no attribute 'keys'


=
system:macOS-15.7.4-arm64-arm-64bit
version:v3.97
frozen:False
language:en
root_dir:/Users/username/pyvideotrans
Python: 3.10.19 (main, Feb 12 2026, 00:36:33) [Clang 21.1.4 ]

3 Replies

The error occurs when switching the TTS channel – the rolelist variable is None, meaning the software failed to load the list of available voices for that channel.

Root cause:
Each TTS channel stores its voice list in a JSON file inside videotrans/voicejson/. If that file is missing, corrupted, or fails to download (e.g., due to network issues when fetching online voices like Edge-TTS), the software passes None instead of a dictionary.

Solutions (in order of likelihood):

  1. Check voice JSON files

    • Go to videotrans/voicejson/ in your installation directory.
    • Look for a JSON file matching the TTS channel you selected (e.g., edge-tts.json, qwen-tts.json, etc.).
    • If missing or empty, try re-downloading a fresh copy from the GitHub repository.
    • If present but corrupt, delete it and restart the software – it will be regenerated.
  2. Ensure network connectivity

    • For online TTS channels (Edge-TTS, OpenAI-TTS, etc.), a stable internet connection is required to fetch the voice list.
    • If you are behind a proxy or firewall, configure it in Menu → Tools → Advanced Options → Network Proxy.
    • Try switching to a local channel (e.g., Qwen-TTS, Piper-TTS) to verify the issue is network‑related.
  3. Reset configuration

    • Back up videotrans/params.json and delete it.
    • Restart the software – this will reset all API keys and settings to defaults, often resolving corrupted configuration issues.
  4. Update pyVideoTrans

    • Your version is v3.97 (macOS ARM). The latest version is v4.03-0626, which includes many bug fixes.
    • Update by pulling the latest code: git pull and then uv sync.

If none of the above help, please provide the full log file from logs/ (the most recent YYYYMMDD.log), especially the lines around this error, for further analysis.


Please refer to related documentation:

I installed F5-TTS locally, run it as a host locally, and provide the URL to pyvideotrans, I cannot set it up correctly and getting the error above

F5-TTS 角色列表加载为 None,导致 AttributeError,根本原因通常是:

  1. API 地址未正确填写(pyvideotrans 无法连接 F5-TTS 服务)
  2. 参考音频未正确配置(F5-TTS 渠道无可用音色)

按以下步骤排查与修复:


1. 确认 F5-TTS 服务正在运行

  • 在浏览器中打开 http://127.0.0.1:7860,应能看到 F5-TTS 的 WebUI 页面。
  • 如果无法访问,先启动 F5-TTS 服务(参考其文档启动 webui.pyapp.py)。
  • 注意:不要填写 0.0.0.0,必须改为 127.0.0.1。如果填 0.0.0.0 会报错。

2. 在 pyvideotrans 中正确配置 API 地址

  • 打开 pyvideotrans 菜单 → TTS 设置F5TTS(注意:F5-TTS 与 Spark/Index/Dia/VoxCPM/Confucius4 共用同一个设置面板)。
  • API 地址 栏填写:http://127.0.0.1:7860(默认端口,若你修改过则用实际端口)。
  • 点击 保存

3. 配置参考音频(必须)

F5-TTS 是克隆式 TTS,必须提供参考音频才能生成音色列表。

  • 在软件根目录下找到 f5-tts 文件夹(若不存在则手动创建)。
  • 放入一段 3~10秒wav 格式 参考音频,命名为简短英文,例如 myvoice.wav
  • 打开 菜单 → TTS 设置 → 设置参考音频,在新行中添加:

    myvoice.wav#该音频中说的文本内容
  • 保存并退出。

4. 选择配音角色

  • 回到主界面,选择 Dubbing Channel = F5-TTS
  • Select Voice 下拉框中应能看到你刚配置的 myvoice.wav,选中它。
  • 如果下拉框仍然为空(或报错),说明第 2 或第 3 步未生效,请检查日志。

5. 检查日志

打开 logs/ 目录下最新的日志文件,搜索 F5-TTSf5,查看是否有连接失败、文件未找到等具体错误。若仍有问题,请提供日志末尾 30 行。


参考文档

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update. Dondate: ko-fi.com/jianchang512

Related resource