Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.85k stars 1.84k forks source link

Python function speak_ssml has lost return value #1704

Closed msehnout closed 1 year ago

msehnout commented 1 year ago

Describe the bug Hi,

I could not find an upstream repo of the azure-cognitiveservices-speech Python package, so I'm reporting it here as it seems to be the closest repository available.

In the version 1.23.0, the function speak_ssml had a return value:

    def speak_ssml(self, ssml: str) -> SpeechSynthesisResult:
        """
        Performs synthesis on ssml in a blocking (synchronous) mode.

        :return: A SpeechSynthesisResult.
        """
        return SpeechSynthesisResult(self._impl.speak_ssml(ssml))

In the latest version, 1.24.0, it has lost the return statement (same applies to the speak_text function):

    def speak_ssml(self, ssml: str) -> SpeechSynthesisResult:
        """
        Performs synthesis on ssml in a blocking (synchronous) mode.

        :returns: A SpeechSynthesisResult.
        """
        self.speak_ssml_async(ssml).get()

To Reproduce Install packages 1.23.0 and 1.24.0 and see for yourself.

Expected behavior Functions still return values as they claim in the docs comment.

Version of the Cognitive Services Speech SDK 1.24.0

Platform, Operating System, and Programming Language

Additional context pylint reported this issue after I updated my dependencies:

 E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)
rhurey commented 1 year ago

Thanks for pointing this out, it's being fixed and will be in the next release.

msehnout commented 1 year ago

By the way is there a plan to publish the Python library as open source here on Github? Given that it is Python source code, I can see it anyway after downloading it. The only difference is that I cannot easily fork it and patch it for myself. I'm testing Python 3.11 right now and I got stuck on this bug. It's a pity given that I could just easily fork it, fix it, and redirect pip to my git fork until the next release :-(.

yulin-li commented 1 year ago

We fixed this issue internally and will be in the next release. As a work around, you can use speak_ssml_async(ssml).get() instead of speak_ssml(ssml).

For the open source, thank you for your suggestion and we will discuss the proposal internally

msehnout commented 1 year ago

We fixed this issue internally and will be in the next release. As a work around, you can use speak_ssml_async(ssml).get() instead of speak_ssml(ssml).

Oops, I've completely missed this :facepalm: . Thanks!

BrianMouncer commented 1 year ago

I had to do a 1.24.1 patch, and this was included. Please verify with https://pypi.org/project/azure-cognitiveservices-speech/1.24.1/

msehnout commented 1 year ago

It works! Thanks :-)