我正在 Python 中创建一个 HTTP 函数,它将从存储中获取 csv blob,使用 scipy 和 matplotlib 执行一些操作,并使用 wkhtmltopdf 将 pdf 输出到同一容器。我在本地系统上执行任何此操作都没有问题,但像大多数事情一样,当我部署它时它会停止工作。
该函数需要覆盖 pickle 文件(在 blob 存储中),创建多个图像 (.png) 和 html 文件,并引用 wkhtmltopdf 的 exe 将这些 png 和 html 转换为 pdf。pickle 部分首先出现,并在此行上捕获此错误
所以看起来我无法写入当前目录,这将证明是图像的问题。
这是处理这种情况的错误方法吗?
有人可以问我正确的问题来缩小问题的根源吗?
下面是我的代码的一个子集:
sas_token_output_html = generate_blob_sas(account_name='***',
account_key='***',
container_name=container,
blob_name='output.html',
permission=BlobSasPermissions(read=True, write=True, create=True),
expiry=datetime.datetime.utcnow() + datetime.timedelta(hours=1))
output_html_url =f'https://***.blob.core.windows.net/{container}/output.html?{sas_token_output_html}'
template_vars = {
'week_day':'Wednesday',
'month':datetime.date.today().strftime('%B'),
'day': datetime.date.today().day,
'year': datetime.date.today().year,
...}
message_html = template.render(template_vars)
with open('output_html_url','w') as f:
f.write(message_html)
富国沪深
一只甜甜圈
相关分类