#2127 TaskCfg(cache_folder=None, target_dir='c:/users/admin/videos/pyvideotrans/translate', remove_noise=False, is_separate=Fa

2402:800* Posted at: 1 day ago 👁19

Trans Error:[Gemini AI] Expecting property name enclosed in double quotes: line 1 column 2 (char 1):
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 78, in run
File "videotrans\translator\_base.py", line 137, in _run_srt
File "tenacity\__init__.py", line 338, in wrapped_f
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 421, in exc_check
tenacity.RetryError: RetryError[]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\task\job.py", line 184, in run
File "videotrans\task\_translate_srt.py", line 45, in trans
File "videotrans\translator\__init__.py", line 932, in run
File "videotrans\translator\_base.py", line 81, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_gemini.py", line 111, in _item_task
File "google\genai\models.py", line 5783, in generate_content_stream
File "google\genai\models.py", line 4666, in _generate_content_stream
File "google\genai\_api_client.py", line 775, in request_streamed
File "google\genai\_api_client.py", line 237, in segments
File "json\__init__.py", line 346, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 353, in raw_decode
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

TaskCfg(cache_folder=None, target_dir='c:/users/admin/videos/pyvideotrans/translate', remove_noise=False, is_separate=False, detect_language=None, subtitle_language=None, source_language=None, target_language=None, source_language_code='Vietnamese', target_language_code='Vietnamese', source_sub='D:/bao chua/111.srt', target_sub='c:/users/admin/videos/pyvideotrans/translate/111.Vietnamese.srt', source_wav=None, source_wav_output=None, target_wav=None, target_wav_output=None, subtitles=None, novoice_mp4=None, noextname='111', shibie_audio=None, targetdir_mp4=None, instrument=None, vocal=None, back_audio=None, background_music=None, app_mode='biaozhun', subtitle_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role=None, copysrt_rawvideo=False, clear_cache=False, translate_type=5, tts_type=None, recogn_type=None, model_name=None, split_type=0, voice_autorate=False, video_autorate=False, cuda=False, name='D:/bao chua/111.srt', basename='111.srt', ext='srt', dirname='D:/bao chua', shound_del_name=None, uuid='1775be5694', remove_silent_mid=False, align_sub_audio=True, enable_diariz=False, nums_diariz=0, rephrase=2, only_out_mp4=False)


=
system:Windows-10-10.0.26100-SP0
version:v3.90
frozen:True
language:en
root_dir:E:/pyvideo

1 Replies

The error JSONDecodeError: Expecting property name enclosed in double quotes indicates that the Gemini AI API returned a response that is not valid JSON. This is a known issue where the model's response may not be properly formatted for the software to parse.

Here are the steps to resolve this issue:

  1. Change the Translation Prompt: The most effective solution is to modify the prompt sent to Gemini. In the main interface, click on the "Settings" button (the gear icon) next to the translation channel dropdown (where you selected Gemini).
  2. In the settings window, find the "Translation Prompt" field for Gemini.
  3. Replace the existing prompt with the following one, which is designed to enforce strict JSON output:

    Translate the following subtitle lines from {source_language} to {target_language}. You must return a valid JSON array where each element is the translated text for the corresponding line. Do not include any explanations, notes, or additional text. Only output the JSON array.
    
    Example format for 2 lines: ["translated line 1", "translated line 2"]
    
    Subtitle lines to translate:
    {raw_text}
  4. Click "Save" and try the translation again.

If the problem persists:

  • Check your API Key: Ensure your Gemini API key is correctly entered in the settings and has sufficient quota.
  • Reduce Batch Size: Go to Menu -> Tools -> Advanced Options. Under the "Subtitle Translation Adjustment" section, reduce the "Number of subtitle lines per batch" to a smaller number (e.g., 5 or 10). Sending fewer lines at once can make the model's response more consistent.
  • Use a Different Model/Channel: Temporarily switch to another translation channel (e.g., Google, DeepSeek, or OpenAI) to complete your task.

If none of the above works, please provide the complete log file from the videotrans/logs/ directory for further analysis.

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

Similar issues already exist

Trending Questions