Mor*_*rti 7 python azure-functions azure-functions-core-tools
我在本地遇到 azure 函数的奇怪警告。每当我func start执行函数时,我都会收到以下错误消息:
Found Python version 3.10.12 (python3).
Azure Functions Core Tools
Core Tools Version: 4.0.5455 Commit hash: N/A (64-bit)
Function Runtime Version: 4.27.5.21554
[2023-11-14T10:02:39.795Z] Customer packages not in sys path. This should never happen!
[2023-11-14T10:02:42.194Z] Worker process started and initialized.
Run Code Online (Sandbox Code Playgroud)
在host.json中,extensionBundle版本是[3.*, 4.0.0)
在local.settings.json中,"FUNCTIONS_WORKER_RUNTIME": "python"
函数app基于python azure函数的新模型(func init MyProjFolder --worker-runtime python --model V2 https://learn. microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=linux%2Cisolated-process%2Cnode-v4%2Cpython-v2%2Chttp-trigger%2Ccontainer-apps&pivots=programming-language-python )
我的第一次审讯是第一次警告:
Customer packages not in sys path. This should never happen!。我正在使用虚拟环境。
功能正常启动,但是这个警告是什么?
本地.settings.json:
Found Python version 3.10.12 (python3).
Azure Functions Core Tools
Core Tools Version: 4.0.5455 Commit hash: N/A (64-bit)
Function Runtime Version: 4.27.5.21554
[2023-11-14T10:02:39.795Z] Customer packages not in sys path. This should never happen!
[2023-11-14T10:02:42.194Z] Worker process started and initialized.
Run Code Online (Sandbox Code Playgroud)
当您在本地开发和运行 azure 函数时,通常会出现此警告。如果您查看Azure Functions 的 Python Worker的源代码,则此日志记录发生在此处。
if CUSTOMER_PACKAGES_PATH not in sys.path:
logger.warning("Customer packages not in sys path.")
Run Code Online (Sandbox Code Playgroud)
CUSTOMER_PACKAGES_PATH定义为:
CUSTOMER_PACKAGES_PATH = "/home/site/wwwroot/.python_packages/lib/site-packages"
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,路径以该路径开头,/home/site/wwwroot这就是部署后文件路径的样子。因此,此检查旨在确保部署后路径配置正确。本地开发时可以忽略该警告。
这似乎是最新版本的Azure function Core 工具 (4.0.5455)的问题,正如官方文档中提到的,该工具是最近(6 天前)发布的。

我创建了一个 python Azure 函数来检查相同的内容:
Python Version: 3.11.5
Azure Functions Core Tools
Core Tools Version: 4.0.5348 Commit hash: N/A (64-bit)
Function Runtime Version: 4.24.5.21262
Run Code Online (Sandbox Code Playgroud)

将 Azure 函数核心工具版本更新为4.0.5455.
使用以下版本再次运行相同的 Azure Function:
Python version 3.11.6 (py).
Azure Functions Core Tools
Core Tools Version: 4.0.5455 Commit hash: N/A (64-bit)
Function Runtime Version: 4.27.5.21554
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
5305 次 |
| 最近记录: |