Closed Ray12345678910 closed 4 years ago
Hi, please try installing the module into your python environment using pip install
, as described in the instructions, and then remove the swagger_client directory from your working directory. If that doesn't help, please put the command print(dir(cris_client))
before the failing command, and post the output here.
Hi, please try installing the module into your python environment using
pip install
, as described in the instructions, and then remove the swagger_client directory from your working directory. If that doesn't help, please put the commandprint(dir(cris_client))
before the failing command, and post the output here.
Thanks for your help! 1). I exactly followed the instruction (the installing via pip the Python Client). 2). When I run this in the command line, it gives no error:
C:\Users\xxx>python -c "import swagger_client"
3). When running the main script again, I received the same error as this topics name. 4). I removed 'swagger_client'. Resulting in: ModuleNotFoundError: No module named 'swagger_client' 5). I restored the 'swagger_client' again, and added your print suggestion:
runfile('C:/Users/xxx/Desktop/Azure_Blob_Text/cognitive-services-speech-sdk-master/samples/batch/python/python-client/main.py', wdir='C:/Users/xxx/Desktop/Azure_Blob_Text/cognitive-services-speech-sdk-master/samples/batch/python/python-client')
Starting transcription client...
['ApiClient', 'ApiResponse', 'Category', 'Configuration', 'Order', 'Pet', 'PetApi', 'StoreApi', 'Tag', 'User', 'UserApi', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'absolute_import', 'api', 'api_client', 'configuration', 'models', 'rest']
Traceback (most recent call last):
File "C:\Users\xxx\Desktop\Azure_Blob_Text\cognitive-services-speech-sdk-master\samples\batch\python\python-client\main.py", line 144, in <module>
transcribe()
File "C:\Users\xxx\Desktop\Azure_Blob_Text\cognitive-services-speech-sdk-master\samples\batch\python\python-client\main.py", line 47, in transcribe
transcription_api = cris_client.CustomSpeechTranscriptionsApi(api_client=client)
AttributeError: module 'swagger_client' has no attribute 'CustomSpeechTranscriptionsApi'
Many thanks for your help!!
Hi,
this looks very much like the default API that the swagger autogenerator uses. Apparently the import of https://<your-region>.cris.ai/docs/v2.0/swagger
in the online tool didn't work properly. Please completely remove the current python module from your system (pip uninstall
) and try the complete process again. Please make sure that the swagger website shows the heading "Speech Services API v2.0" before you download the Python client.
Hi, this looks very much like the default API that the swagger autogenerator uses. Apparently the import of
https://<your-region>.cris.ai/docs/v2.0/swagger
in the online tool didn't work properly. Please completely remove the current python module from your system (pip uninstall
) and try the complete process again. Please make sure that the swagger website shows the heading "Speech Services API v2.0" before you download the Python client.
You are right, thanks! What solved the problem, was pasting "westeurope" instead of "west-europe" and "
Glad that it is fixed!
Go through the README on the site.
To execute the sample you need to generate the Python library for the REST API which is generated through Swagger.
Follow these steps for the installation:
https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cognitiveservices/data-plane/Speech/SpeechToText/stable/v3.1/speechtotext.json
.pip install path/to/package/python-client
.python -c "import swagger_client"
Follow these steps. It will work.
Hi community,
I am following the tutorial "How to use the Speech Services Batch Transcription API from Python" (see: https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/batch/python).
After following all the steps (downloading the "cognitive-services-speech-sdk', moving the 'python-client-generated' -from swagger- file in that folder) and changing my Subscription key, service region and blob uri I receive the following error:
The error occurs in the transcribe function:
Anyone ideas how I can solve this (or what I am doing wrong?).
Many thanks in advance!