小编Mat*_*lde的帖子

AWS SAM CLI 抛出错误:构建 docker 映像时出错

我正在尝试在我的 M1 Mac 上使用 SAM CLI。

\n

我按照这些文档中概述的步骤进行操作:

\n
sam init\ncd sam-app\nsam build\nsam deploy --guided\n
Run Code Online (Sandbox Code Playgroud)\n

我没有修改代码或 yaml 文件。\n我可以按预期启动本地 Lambda 函数:

\n
\xe2\x9e\x9c  sam-app sam local start-api\nMounting HelloWorldFunction at http://127.0.0.1:3000/hello [GET]\nYou can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions, changes will be reflected instantly/automatically. If you used sam build before running local commands, you will need to re-run sam build for the changes …
Run Code Online (Sandbox Code Playgroud)

python docker aws-lambda aws-sam-cli serverless

9
推荐指数
1
解决办法
4486
查看次数

为什么math.inf是浮点数,为什么不能将其转换为整数?

我正在做一些实验,并且正在尝试这样做:

import math
for i in range(math.inf):
    print(i)
Run Code Online (Sandbox Code Playgroud)

我希望它与此完全相同:

c = 0
while True:
    print(c)
    c += 1
Run Code Online (Sandbox Code Playgroud)

但它更像这样

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'float' object cannot be interpreted as an integer
Run Code Online (Sandbox Code Playgroud)

然后,我尝试将转换inf为浮点数:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'float' object cannot be interpreted as an integer
Run Code Online (Sandbox Code Playgroud)

但这给了我这个错误,表明您不能将float infinity转换为整数。

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: cannot convert float infinity …
Run Code Online (Sandbox Code Playgroud)

python math infinity

2
推荐指数
1
解决办法
286
查看次数

标签 统计

python ×2

aws-lambda ×1

aws-sam-cli ×1

docker ×1

infinity ×1

math ×1

serverless ×1