I am going thru this Microsoft Learn Module: "Quickstart: Generate images with Azure OpenAI Service"
https://learn.microsoft.com/en-us/azure/ai-services/openai/dall-e-quickstart?tabs=dalle3%2Ccommand-line&pivots=programming-language-python
This python code is not working in the module: https://learn.microsoft.com/en-us/azure/ai-services/openai/dall-e-quickstart?tabs=dalle3%2Ccommand-line&pivots=programming-language-python#generate-images-with-dall-e
I get the error below:
Traceback (most recent call last):
File "C:\Users\ziggy\azureopenaisample\generative-ai-for-beginners\generative-ai-for-beginners\09-building-image-applications\python\app1.py", line 17, in <module>
result = client.images.generate(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai\resources\images.py", line 251, in generate
return self._post(
^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 1055, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 834, in request
return self._request(
^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 877, in _request
raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
My deployment seems to be correct:

And I am generating images in the playground too:

Upon clicking View code above, it generates a code as well:

I input that same code in Visual Studio and I get the same error as above:
Traceback (most recent call last):
File "C:\Users\ziggy\azureopenaisample\generative-ai-for-beginners\generative-ai-for-beginners\09-building-image-applications\python\app1.py", line 17, in <module>
result = client.images.generate(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai\resources\images.py", line 251, in generate
return self._post(
^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 1055, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 834, in request
return self._request(
^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 877, in _request
raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
PS C:\Users\ziggy\azureopenaisample\generative-ai-for-beginners\generative-ai-for-beginners\09-building-image-applications\python> python app1.py
Traceback (most recent call last):
File "C:\Users\ziggy\azureopenaisample\generative-ai-for-beginners\generative-ai-for-beginners\09-building-image-applications\python\app1.py", line 17, in <module>
result = client.images.generate(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai\resources\images.py", line 251, in generate
return self._post(
^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 1055, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 834, in request
return self._request(
^^^^^^^^^^^^^^
File "C:\Users\ziggy\AppData\Roaming\Python\Python312\site-packages\openai_base_client.py", line 877, in _request
raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}