小编Jac*_*man的帖子

Google 应用程序引擎部署失败 - 查找“pip”的模块规范时出错(AttributeError:模块“__main__”没有属性“__file__”)

我们使用命令提示符c:\gcloud app deploy app.yaml,但出现以下错误:

Running "python3 -m pip install --requirement requirements.txt --upgrade --upgrade-strategy only-if-needed --no-warn-script-location --no-warn-conflicts --force-reinstall --no-compile (PIP_CACHE_DIR=/layers/google.python.pip/pipcache PIP_DISABLE_PIP_VERSION_CHECK=1)"
Step #2 - "build": /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Step #2 - "build": Done "python3 -m pip install --requirement requirements.txt --upgr..." (34.49892ms)
Step #2 - "build": Failure: (ID: 0ea8a540) /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Step #2 - "build": …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine google-app-engine-python

18
推荐指数
2
解决办法
2112
查看次数

invalidateLayout with invalidateSupplementaryElements和UICollectionViewLayoutInvalidationContext

我正在尝试刷新页脚(supplementElement).我正在使用-invalidatelayout方法.根据这里的 SO建议.Apple文档在这里.我收到以下错误

***由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'发送到的无效的上下文() - [UICollectionViewFlowLayout invalidateLayoutWithContext:]不是UICollectionViewFlowLayoutInvalidationContext类型的实例或子类'

let footer_context = UICollectionViewLayoutInvalidationContext()
footer_context.invalidateSupplementaryElements(ofKind: "ActivitiesSelectMembersFooterView", at: [indexPath])
self.collectionView?.collectionViewLayout.invalidateLayout(with: footer_context)
Run Code Online (Sandbox Code Playgroud)

看起来invalidateLayout方法期望UICollectionViewFlowLayoutInvalidationContext而不是UICollectionViewLayoutInvalidationContext.

我正在使用Xcode 8和Swift 3.

Xcode中的我的故事板在这里 -

在此输入图像描述

"下一步"是具有自定义类"ActivitiesSelectMembersFooterView"的页脚

ios swift

7
推荐指数
1
解决办法
1957
查看次数

firestore python google cloud中的document.id(自动生成)是否有最大字符长度

我们正在为我们的数据库使用 Firestore。自动生成的文档 ID 是否有最大字符长度?我似乎无法在任何地方的文档中找到答案。

google-cloud-firestore

3
推荐指数
1
解决办法
1341
查看次数

Sendgrid 错误 - ValueError('请使用收件人、抄送或密件抄送对象。',)

我们在谷歌应用引擎标准上使用 sendgrid 6.0.5 python2.7。

以下代码有效

subject = data_sent_obj["subject"]
body_html            = data_sent_obj["body_html"]
body_text            = data_sent_obj["body_text"]

email_id_variable = "info@mycompany.com"
to_email = "info@mycompany.com"         # THIS WORKS
# to_email = Email(email_id_variable)   # THIS DOES NOT WORK

email_message = Mail(
    from_email          = 'info@mycompany.com',
    to_emails           = to_email,
    subject             = subject,                   
    html_content        = body_html)

personalization = Personalization()
personalization.add_to(Email(to_email))
bcc_list = bcc_email_list
for bcc_email in bcc_list:
    personalization.add_bcc(Email(bcc_email))


email_message.add_personalization(personalization)


try:
    sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
    response = sg.send(email_message)
Run Code Online (Sandbox Code Playgroud)

当我们使用

to_email = Email(email_id_variable) we get the following error.
Run Code Online (Sandbox Code Playgroud)
ValueError('Please use a To, …
Run Code Online (Sandbox Code Playgroud)

python-2.7 sendgrid

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

Firestore分页-如何查找查询后是否有更多数据(使用限制)

我们在当前的 python 2.7 标准环境中使用 ndb 数据存储。我们使用 firestore(本机模式)将此应用程序迁移到 python 3.7 标准环境。

我们在 ndb 数据存储上使用分页并使用 fetch 构建查询。

 query_results , next_curs, more_flag = query_structure.fetch_page(10)
Run Code Online (Sandbox Code Playgroud)

next_curs 和 more_flag 对于指示当前查询后是否还有更多数据要获取(获取 10 个元素)非常有用。我们用它来标记“下一页”/“上一页”的前端。

我们在 Firestore 中找不到类似的东西。有人可以帮助如何实现这一目标吗?

google-cloud-firestore

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