尝试在 App Engine 上托管 API 时,不断出现以下错误。该程序曾经在 Flask 上运行,Flask 可以运行,但速度非常慢。
"Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle
self.handle_request(listener, req, client, addr)
File "/env/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request
respiter = self.wsgi(environ, resp.start_response)
TypeError: __call__() missing 1 required positional argument: 'send'
"
Run Code Online (Sandbox Code Playgroud)
FROM gcr.io/google_appengine/python
RUN apt-get update && apt-get install -y ffmpeg
# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
RUN virtualenv /env -p python3.7
# Setting these environment variables are …
Run Code Online (Sandbox Code Playgroud) python google-app-engine gunicorn google-cloud-platform fastapi
有没有办法更新PyPi包而不更改版本号?
想象一下,我在最近上传到PyPi的软件包中发现了一个小错误.有没有办法编辑/重新上传代码而不增加版本号?
更新
我想我应该澄清一下,"bug"我的意思是实际源代码中的版本号是错误的 - 它不是一个功能性的东西,它只是意味着你package.version
是否得到了以前的版本,而不是当前版本(是的我知道这可能会导致其他人的代码中的错误,但鉴于我们处于alpha状态,我希望版本依赖关系还没有设置好......).为了记录,明显无声的错误修复是坏的!
我正在尝试使用Google Cloud Vision API中现在支持的PDF/TIFF文档文本检测.使用他们的示例代码,我能够提交PDF并接收带有提取文本的JSON对象.我的问题是保存到GCS的JSON文件只包含"符号"的边界框和文本,即每个单词中的每个字符.这使得JSON对象非常难以使用并且非常难以使用.我希望能够获得"LINES","PARAGRAPHS"和"BLOCKS"的文本和边界框,但我似乎无法通过该AsyncAnnotateFileRequest()
方法找到方法.
示例代码如下:
def async_detect_document(gcs_source_uri, gcs_destination_uri):
"""OCR with PDF/TIFF as source files on GCS"""
# Supported mime_types are: 'application/pdf' and 'image/tiff'
mime_type = 'application/pdf'
# How many pages should be grouped into each json output file.
batch_size = 2
client = vision.ImageAnnotatorClient()
feature = vision.types.Feature(
type=vision.enums.Feature.Type.DOCUMENT_TEXT_DETECTION)
gcs_source = vision.types.GcsSource(uri=gcs_source_uri)
input_config = vision.types.InputConfig(
gcs_source=gcs_source, mime_type=mime_type)
gcs_destination = vision.types.GcsDestination(uri=gcs_destination_uri)
output_config = vision.types.OutputConfig(
gcs_destination=gcs_destination, batch_size=batch_size)
async_request = vision.types.AsyncAnnotateFileRequest(
features=[feature], input_config=input_config,
output_config=output_config)
operation = client.async_batch_annotate_files(
requests=[async_request])
print('Waiting for the operation …
Run Code Online (Sandbox Code Playgroud) 我已将我的python包上传到pypi.但现在我制作了我的包的新版本,需要上传它.我试着在第一次上传包时做了同样的进展.但是给我这个错误:
HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy
Run Code Online (Sandbox Code Playgroud)
现在,如何上传新版本没有任何错误?!
突然间,我在尝试使用我以前工作过(好几个月)的需求文件时遇到了很多错误。我试图去 pypi.org 并得到相同的 404 错误。
我的设置有问题吗?
> pip install -r requirements.txt
Collecting get==2019.4.13 (from -r requirements.txt (line 4))
Cache entry deserialization failed, entry ignored
Exception:
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/get/
Run Code Online (Sandbox Code Playgroud)
如果我删除行get==2019.4.13
下一个错误是:
> pip install -r requirements.txt
Collecting post==2019.4.13 (from -r requirements.txt (line 11))
Cache entry deserialization failed, entry ignored
Exception:
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/post/
Run Code Online (Sandbox Code Playgroud) 我在MailChimp v3 API上遇到问题,当我尝试重新订阅成员时,它会以状态400响应.以下是重现问题的步骤:
通过端点使用API重新订阅PUT/lists/{list_id}/members/{subscriber_hash}返回状态400
{'type':' http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/','title ':'忘记电子邮件未订阅','状态':400,'详细':' some@email.com已被永久删除,无法重新导入.联系人必须重新订阅才能返回列表.}
并且请求是:
{
email_address: 'some@email.com',
status_if_new: 'subscribed'
}
Run Code Online (Sandbox Code Playgroud)
基于响应,解决方案是必须重新订阅成员,我实际上正在尝试做.有谁遇到过这个问题?
每当我必须使用gcloud
sdk部署新的 python 函数时,我都会收到此消息
允许未经身份验证的新函数 [function-name] 调用?
(是/否)?
警告:使用受限访问 IAM 策略创建的函数。要启用未经授权的访问,请考虑
“gcloud alpha 函数 add-iam-policy-binding function-name --region=europe-west1 --member=allUsers --role=roles/cloudfunctions.invoker”
是否有任何标志可以添加到命令中以使其NO
在部署时成为一个?
这是我用来部署一个函数的示例命令:
gcloud functions deploy function-name --region=europe-west1 --entry-point function-entry-point --trigger-resource "projects/my-project/databases/(default)/documents/user_ids/{user_id}" --trigger-event providers/cloud.firestore/eventTypes/document.create --runtime python37 --timeout 60 --project my-project
Run Code Online (Sandbox Code Playgroud) python google-cloud-platform gcloud gcloud-python google-cloud-functions
我在使用 python(3.5) 部署我的 django(2.1) 应用程序到 appengine 时遇到了这个错误。之前,我在 app.yaml 中使用 python 2 和 python27,没有这样的错误,但是现在当我的 app.yaml 中有 python 3.5.2 和 python37 时,我在“gcloud app deploy”之后遇到了这个错误。我真的必须启用计费功能还是我做错了什么?有出路吗?完整的错误是
错误:(gcloud.app.deploy) 错误响应:[7] 未配置访问权限。Cloud Build 之前未在项目 chaipani-217815 中使用过或已禁用。通过访问https://console.developers.google.com/apis/api/cloudbuild.googleapis.com/overview?project=chaipani-217815启用它,然后重试。如果您最近启用了此 API,请等待几分钟,让操作传播到我们的系统并重试。
django google-app-engine python-3.x app.yaml google-cloud-platform
我有一个 GCF--runtime python37 --trigger-topic <pubsub_topic>
运行了大约一个月,但今天只有三个错误。
Error: cannot communicate with function. Request rejected.
由于Stackdriver Logs中没有针对此类错误的execution_id,因此很难调试和跟踪。
顺便说一句,没有超过 from IAM & admin
- 的配额限制Quotas
。
python google-cloud-platform google-cloud-functions serverless
我想从我的应用引擎标准 python3 应用程序向堆栈驱动程序日志发送更具表现力的日志条目。通过遵循官方文档,我能够将我的日志发送到 stackdriver,并且时间戳似乎被正确解析。
但我错过了严重程度。此外,我看不到将某个请求的日志链接到操作的方法。java日志记录似乎是开箱即用的。
供参考,这是我的代码:
import logging
import os
from flask import Flask
from google.cloud import logging as glog
app = Flask(__name__)
log_client = glog.Client(os.getenv('GOOGLE_CLOUD_PROJECT'))
# Attaches a Google Stackdriver logging handler to the root logger
log_client.setup_logging()
@app.route('/_ah/push-handlers/cloudbuild', methods=['POST'])
def pubsub_push_handle():
logging.info("stdlib info")
logging.warning("stdlib warn")
logging.error("stdlib error")
Run Code Online (Sandbox Code Playgroud)
导致堆栈驱动程序的日志:
如您所见,时间戳和消息可用,而严重性奇怪地缺失,它被归类为“任何”
有人可以指出我正确的方向,还是这种级别的合并尚不可用?
谢谢你的时间!卡斯腾
google-app-engine python-3.x google-cloud-platform stackdriver google-cloud-stackdriver
python ×7
python-3.x ×4
pypi ×3
app.yaml ×1
django ×1
fastapi ×1
gcloud ×1
gunicorn ×1
package ×1
pip ×1
serverless ×1
stackdriver ×1
twine ×1