I keep getting the error
ModuleNotFoundError: No module named ‘azure’
for line 4 where I import azure.functions as func
Below is the code for my init file that has been designed using this tutorial
JavaScript
x
24
24
1
import logging
2
import azure.functions as func
3
4
def main(req: func.HttpRequest) -> func.HttpResponse:
5
logging.info('Python HTTP trigger function processed a request.')
6
7
name = req.params.get('name')
8
if not name:
9
try:
10
req_body = req.get_json()
11
except ValueError:
12
pass
13
else:
14
name = req_body.get('name')
15
16
if name:
17
return func.HttpResponse(f"Hellod {name}!")
18
19
else:
20
return func.HttpResponse(
21
"Please pass a name on the query string or in the request body",
22
status_code=400
23
)
24
Any help with this would be much appriciated!
Advertisement
Answer
Did you pip installed the library in your python environment?
JavaScript
1
2
1
pip install azure
2