Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dubbing error #337

Open
wanglongpeng1 opened this issue Aug 2, 2024 · 0 comments
Open

dubbing error #337

wanglongpeng1 opened this issue Aug 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@wanglongpeng1
Copy link

我在使用过程中调用了这个函数
I called this function during use

def download_dubbed_file(dubbing_id: str, language_code: str) -> str:
"""
Downloads the dubbed file for a given dubbing ID and language code.

Args:
    dubbing_id: The ID of the dubbing project.
    language_code: The language code for the dubbing.

Returns:
    The file path to the downloaded dubbed file.
"""
dir_path = f"data/{dubbing_id}"
os.makedirs(dir_path, exist_ok=True)

file_path = f"{dir_path}/{language_code}.mp4"
with open(file_path, "wb") as file:
    for chunk in client.dubbing.get_dubbed_file(dubbing_id, language_code):
        file.write(chunk)

return file_path

在这一行中发生了报错
An error has occurred in this line
”for chunk in client.dubbing.get_dubbed_file(dubbing_id, language_code):
file.write(chunk)“

以下是报错信息
The following is the error message.

Traceback (most recent call last):
File "/datahdd/wyz/wlp/11LABS_Dubbings/examples/create_a_dub_from_file.py", line 65, in
result = create_dub_from_file(
^^^^^^^^^^^^^^^^^^^^^
File "/datahdd/wyz/wlp/11LABS_Dubbings/examples/create_a_dub_from_file.py", line 58, in create_dub_from_file
output_file_path = download_dubbed_file(dubbing_id, target_language)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/datahdd/wyz/wlp/11LABS_Dubbings/examples/dubbing_utils.py", line 39, in download_dubbed_file
for chunk in client.dubbing.get_dubbed_file(dubbing_id, language_code):
TypeError: 'NoneType' object is not iterable

经过排查,发现/elevenlabs/dubbing/client.py 文件中函数get_dubbed_file 返回的是None
After investigation, it was found that the function get_dubbed_file in the/elevenlabs/dubbing/client.py file returned None.,

def get_dubbed_file(
self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
Returns dubbed file as a streamed file. Videos will be returned in MP4 format and audio only dubs will be returned in MP3.

    Parameters:
        - dubbing_id: str. ID of the dubbing project.

        - language_code: str. ID of the language.

        - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
    ---
    from elevenlabs.client import ElevenLabs

    client = ElevenLabs(
        api_key="YOUR_API_KEY",
    )
    client.dubbing.get_dubbed_file(
        dubbing_id="dubbing_id",
        language_code="language_code",
    )
    """
    # print("在这里/anaconda3/envs/eleventlabs_wlp_t/lib/python3.11/site-packages/elevenlabs/dubbing/client.py")
    _response = self._client_wrapper.httpx_client.request(
        "GET",
        urllib.parse.urljoin(
            f"{self._client_wrapper.get_base_url()}/",
            f"v1/dubbing/{jsonable_encoder(dubbing_id)}/audio/{jsonable_encoder(language_code)}",
        ),
        params=jsonable_encoder(
            request_options.get("additional_query_parameters") if request_options is not None else None
        ),
        headers=jsonable_encoder(
            remove_none_from_dict(
                {
                    **self._client_wrapper.get_headers(),
                    **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                }
            )
        ),
        timeout=request_options.get("timeout_in_seconds")
        if request_options is not None and request_options.get("timeout_in_seconds") is not None
        else self._client_wrapper.get_timeout(),
        retries=0,
        max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
    )
    if 200 <= _response.status_code < 300:
        return
    if _response.status_code == 422:
        raise UnprocessableEntityError(
            typing.cast(HttpValidationError, construct_type(type_=HttpValidationError, object_=_response.json()))  # type: ignore
        )
    try:
        _response_json = _response.json()
    except JSONDecodeError:
        raise ApiError(status_code=_response.status_code, body=_response.text)
    raise ApiError(status_code=_response.status_code, body=_response_json)

我不知道是不是这个原因,是我下载的版本有问题吗?
I don't know if this is the reason. Is there a problem with the version I downloaded?

@dsinghvi dsinghvi added the bug Something isn't working label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants