无法成功运行"func host start"以测试azure功能 [英] Unable to successfully run 'func host start' to test azure function

查看:143
本文介绍了无法成功运行"func host start"以测试azure功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照此处的MSDN说明对python azure函数执行一些本地测试: https://docs.microsoft. com/en-us/azure/azure-functions/functions-create-first-function-python

I'm trying to perform some local testing of a python azure function following the MSDN instructions here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-python

我已经安装了所有必需的依赖项,包括Python 3.6,Azure Functions Core工具,Azure CLI和我有一个活跃的Azure订阅.我还已经通过az login在Powershell管理员模式下登录了我的Azure accont.

I've installed all the necessary dependencies including Python 3.6, Azure Functions Core Tools, Azure CLI & I have an active Azure subscription. I've also signed into my Azure accont via az login in powershell administrator mode.

一旦我按照MSDN文档&中的提示步骤进行操作,运行func host start powershell输出以下代码段.出现在我身上的错误是AttributeError: module 'azure.functions_worker' has no attribute 'start_async'.我已经研究了此错误&已经看到其他人通过卸载&通过Chocolatey重新安装azure-functions-core-tools,我通过按照以下线程进行操作:

Once I've gone through the prompted steps in the MSDN doc & run func host start powershell outputs the following snippet. The error that sticks out to me is AttributeError: module 'azure.functions_worker' has no attribute 'start_async'. I've researched this error & have seen others successfully resolve it by uninstalling & reinstalling azure-functions-core-tools via chocolatey which I've done by following the thread here: Azure Python App Function no longer runs locally - module 'azure.functions_worker' has no attribute 'start_async'

问题仍然存在&我无法在本地托管Azure功能&在浏览器中测试GET/POST请求( http://localhost:7071/api/HttpTrigger )请如果您熟悉如何解决此问题,请帮助我.我以为这可能是我的Python版本存在的问题,但我通过在Powershell中运行python --version确认安装了Python 3.6.0

Problem still persists & i'm unable to locally host the azure function & test GET/POST requests in the browser (http://localhost:7071/api/HttpTrigger) Please help me out if you're familiar with how to fix this problem. I thought this could be an issue with my Python version but I confirmed Python 3.6.0 is installed by running python --version in powershell

Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.

Http Functions:

        HttpTrigger: [GET,POST] http://localhost:7071/api/HttpTrigger

[6/26/2019 1:24:31 AM] Traceback (most recent call last):
[6/26/2019 1:24:31 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 37, in main
[6/26/2019 1:24:31 AM]     return aio_compat.run(azure.functions_worker.start_async(
[6/26/2019 1:24:31 AM] AttributeError: module 'azure.functions_worker' has no attribute 'start_async'
[6/26/2019 1:24:31 AM] Traceback (most recent call last):
[6/26/2019 1:24:31 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 46, in <module>
[6/26/2019 1:24:31 AM]     main()
[6/26/2019 1:24:31 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 37, in main
[6/26/2019 1:24:31 AM]     return aio_compat.run(azure.functions_worker.start_async(
[6/26/2019 1:24:31 AM] AttributeError: module 'azure.functions_worker' has no attribute 'start_async'
[6/26/2019 1:24:31 AM] Language Worker Process exited.
[6/26/2019 1:24:31 AM] python exited with code 1
 AttributeError: module 'azure.functions_worker' has no attribute 'start_async'.
[6/26/2019 1:24:31 AM] Starting language worker process:python  "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py" --host 127.0.0.1 --port 64242 --workerId afead7f3-0f5e-4209-91f5-7904d3319d56 --requestId 9a2be9af-32d1-4199-9aaa-0d4aef01eef2 --grpcMaxMessageLength 134217728
[6/26/2019 1:24:31 AM] python process with Id=2360 started
[6/26/2019 1:24:31 AM] Traceback (most recent call last):
[6/26/2019 1:24:31 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 37, in main
[6/26/2019 1:24:31 AM]     return aio_compat.run(azure.functions_worker.start_async(
[6/26/2019 1:24:31 AM] AttributeError: module 'azure.functions_worker' has no attribute 'start_async'
[6/26/2019 1:24:31 AM] Traceback (most recent call last):
[6/26/2019 1:24:31 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 46, in <module>
[6/26/2019 1:24:31 AM]     main()
[6/26/2019 1:24:31 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 37, in main
[6/26/2019 1:24:31 AM]     return aio_compat.run(azure.functions_worker.start_async(
[6/26/2019 1:24:31 AM] AttributeError: module 'azure.functions_worker' has no attribute 'start_async'
[6/26/2019 1:24:31 AM] Language Worker Process exited.
[6/26/2019 1:24:31 AM] python exited with code 1
 AttributeError: module 'azure.functions_worker' has no attribute 'start_async'.
[6/26/2019 1:24:31 AM] Starting language worker process:python  "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py" --host 127.0.0.1 --port 64242 --workerId 899213f3-400d-4355-a0cb-a42e425ef551 --requestId 2e8c49ea-6b15-444a-9e97-a07eefe09808 --grpcMaxMessageLength 134217728
[6/26/2019 1:24:31 AM] python process with Id=10060 started
[6/26/2019 1:24:32 AM] Traceback (most recent call last):
[6/26/2019 1:24:32 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 37, in main
[6/26/2019 1:24:32 AM]     return aio_compat.run(azure.functions_worker.start_async(
[6/26/2019 1:24:32 AM] AttributeError: module 'azure.functions_worker' has no attribute 'start_async'
[6/26/2019 1:24:32 AM] Traceback (most recent call last):
[6/26/2019 1:24:32 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 46, in <module>
[6/26/2019 1:24:32 AM]     main()
[6/26/2019 1:24:32 AM]   File "C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\workers\python\worker.py", line 37, in main
[6/26/2019 1:24:32 AM]     return aio_compat.run(azure.functions_worker.start_async(
[6/26/2019 1:24:32 AM] AttributeError: module 'azure.functions_worker' has no attribute 'start_async'
[6/26/2019 1:24:32 AM] Language Worker Process exited.
[6/26/2019 1:24:32 AM] python exited with code 1
 AttributeError: module 'azure.functions_worker' has no attribute 'start_async'.
[6/26/2019 1:24:32 AM] Exceeded language worker restart retry count for runtime:python. Shutting down Functions Host
[6/26/2019 1:24:32 AM] Shuttingdown Rpc Channels Manager
[6/26/2019 1:24:32 AM] Stopping host...
[6/26/2019 1:24:32 AM] Stopping JobHost
[6/26/2019 1:24:32 AM] Job host stopped
[6/26/2019 1:24:32 AM] Host shutdown completed.
Application is shutting down...

推荐答案

我卸载了Python 3.6.0,然后在虚拟环境中安装了python 3.6.8.然后卸载&在解决该问题的相同虚拟环境中重新安装了azure-functions-core-tools.卸载与安装通过CMD中的Chocolatey完成安装.我还暂时禁用了Windows Defender实时扫描.

I uninstalled Python 3.6.0 then installed python 3.6.8 in a virtual environment. Then uninstalled & re-installed azure-functions-core-tools in the same virtual environment which resolved the problem. Uninstallations & installations done via chocolatey in CMD. I also temporarily disabled Windows Defender real-time scans.

这篇关于无法成功运行"func host start"以测试azure功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆