#1249 IndentationError: expected an indented block after 'try' statement on line 4

104.28* Posted at: 14 hours ago 👁17

Traceback (most recent call last):
File "/Users/tips/voice/pyvideotrans/videotrans/util/ListenVoice.py", line 18, in run

tts.run(

File "/Users/tips/voice/pyvideotrans/videotrans/tts/__init__.py", line 290, in run

from videotrans.tts._f5tts import F5TTS

File "/Users/tips/voice/pyvideotrans/videotrans/tts/_f5tts.py", line 6, in

from gradio_client import Client, handle_file

ModuleNotFoundError: No module named 'gradio_client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/tips/voice/pyvideotrans/videotrans/util/ListenVoice.py", line 28, in run

from videotrans.configure._except import get_msg_from_except

File "/Users/tips/voice/pyvideotrans/videotrans/configure/_except.py", line 6

from videotrans.configure._deepgram import DeepgramApiError
^^^^

IndentationError: expected an indented block after 'try' statement on line 4


=
system:macOS-26.0.1-arm64-arm-64bit
version:v3.82
frozen:False
language:zh
root_dir:/Users/tips/voice/pyvideotrans
Python: 3.10.19 (main, Oct 9 2025, 15:25:03) [Clang 17.0.0 (clang-1700.3.19.1)]

1 Replies

这是一个在 macOS 上使用源码版本时遇到的依赖包缺失和代码语法错误问题。

问题分析:

  1. ModuleNotFoundError: No module named 'gradio_client' - 缺少 gradio_client 依赖包
  2. IndentationError: expected an indented block after 'try' statement - 代码缩进错误

解决方案:

第一步:安装缺失的依赖包
在终端中运行以下命令安装 gradio_client:

pip install gradio_client

第二步:修复代码语法错误
这个错误表明源码中有语法问题。请按以下步骤操作:

  1. 打开文件 /Users/tips/voice/pyvideotrans/videotrans/configure/_except.py
  2. 查看第4行附近的代码,找到 try: 语句
  3. 确保 try: 语句后面有正确的缩进代码块
  4. 如果无法自行修复,建议重新从 GitHub 下载最新源码覆盖现有文件

第三步:重新启动软件
完成上述步骤后,重新启动 pyVideoTrans。

如果问题仍然存在,请提供修复后的完整错误日志。

注意: 您使用的是源码版本 (v3.82),建议定期从 GitHub 更新到最新版本以获取修复。

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.

Donate: https://ko-fi.com/jianchang512

Trending Questions