- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我创建了这个简单的 python 程序,它向 SQS 发送消息然后检索它。它使用 python 2.7.11 工作。
import boto3
sqs = boto3.client('sqs')
queue = sqs.get_queue_by_name(QueueName='some-que-name')
queue.send_message(MessageBody='{"phrase": "It\'s the end of the world as we know it" }' )
for message in queue.receive_messages():
print message.body
然后我用这个脚本 cxFreeze 它:
from cx_Freeze import setup, Executable
include_mods = []
excludes = ['tkinter', 'cltk']
buildOptions = dict(packages=[], excludes=excludes, includes=include_mods)
executables = [
Executable('./frozen_boto_3_test.py', 'Console')
]
setup(name='Boto3FrozenTest',
version='1',
description='A test to make sure boto3 is working well when frozen',
options=dict(build_exe=buildOptions),
executables=executables)
然后当我尝试运行卡住的代码时出现此错误
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
exec(code, m.__dict__)
File "./frozen_boto_3_test.py", line 1, in <module>
import boto3
File "/usr/local/lib/python2.7/site-packages/boto3/__init__.py", line 16, in <module>
from boto3.session import Session
File "/usr/local/lib/python2.7/site-packages/boto3/session.py", line 17, in <module>
import botocore.session
File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 25, in <module>
import botocore.configloader
File "/usr/local/lib/python2.7/site-packages/botocore/configloader.py", line 18, in <module>
from six.moves import configparser
File "/usr/local/lib/python2.7/site-packages/six.py", line 203, in load_module
mod = mod._resolve()
File "/usr/local/lib/python2.7/site-packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/usr/local/lib/python2.7/site-packages/six.py", line 82, in _import_module
__import__(name)
ImportError: No module named ConfigParser
除了这个问题,库似乎动态加载不是 s3、dynamo 或其他服务的服务。
是否有卡住 boto3 的方法?
最佳答案
错误表明正在进行隐藏(动态)导入。如果您在告诉 cx_Freeze 要包含的模块列表中包含它正在寻找的模块 (ConfigParser),它应该可以工作。您可能需要多次执行此操作。
executables = [cx_Freeze.Executable("MyScript.py")]
includes = ["ConfigParser"]
buildOptions = dict(includes = includes)
cx_Freeze.setup(name, description, options = dict(build_exe = buildOptions),
executables = executables)
一旦你有了一个工作程序,你也可以这样做而不是操纵你的特定 setup.py。您可以在 cx_Freeze.hooks 模块中添加一个条目,看起来像这样:
def load_boto3(finder, module):
finder.IncludeModule("ConfigParser")
包括您在此过程中发现的任何其他内容。然后在此处创建拉取请求或问题:
关于python - 如何 cx 卡住 Boto3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40362094/
我已经阅读了关于“describe_cluster_snapshots”的解释...... http://docs.pythonboto.org/en/latest/ref/redshift.html
根据 DynamoDB 文档,如果使用受支持的 SDK,导致数据库节流的请求会自动重试。但是,我找不到任何关于 boto 如何处理节流情况的提及。 boto 会自动重试受限请求还是我应该开始捕获 Pr
有没有办法在 SQS 队列中设置消息的消息属性?我正在尝试检查发送到 SQS 队列的消息并更改其值。下面代码的最后一行获取并打印该值。 for message in queue.receive_mes
我无法从文档/示例中确定如何使用 boto 的 dynamodb2 从 DynamoDB 存储/读取二进制数据。它是如何完成的? 我的猜测是项目值类似于 { 'B': binary-data }但这会
我想获取 dynamodb 表的唯一哈希键值列表。我目前知道的唯一方法是扫描整个表,然后迭代扫描。什么是更好的方法? 最佳答案 rs = list(table.scan(range__eq="rang
我正在使用 boto 访问 dynamodb 表。一切顺利,直到我尝试执行扫描操作。 我尝试了在互联网上反复搜索后发现的几种语法,但没有成功: def scanAssets(self, asset):
我正在使用 Boto 库与 AWS 通信。我想禁用日志记录。 (或重定向到/dev/null 或其他文件)。我找不到明显的方法来做到这一点。我试过了,但这似乎没有帮助: import boto bot
这是我尝试将文档上传到云搜索的代码 from boto.cloudsearch2.layer2 import Layer2 conn_config = { 'region': 'us-east
我已经尝试过: connection = S3Connection( aws_access_key_id=settings.AWS_ACCESS_KEY_ID, aws_secret_
我正在编写一个脚本,以确保我们所有的 EC2 实例都有 DNS 条目,并且所有 DNS 条目都指向有效的 EC2 实例。 我的方法是尝试获取我们域的所有资源记录,以便在检查实例名称时可以遍历列表。 但
查看 boto 文档,当您将消息标识符从 SQS 队列中取出时,我没有看到获取消息标识符的方法。谁能提供一些有关我如何获取这些信息的信息? 最佳答案 Message实例应该有一个名为 id 的属性其中
我的python程序的第一行是from boto.s3.connection import S3Connection . 当我执行程序时,输出是“from: can't read/var/mail/b
我在使用 DynamoDB2 API 使用 boto 2.9.5 执行任何单个或批处理查询时遇到问题 我需要做一个这样的批量查询: one_org = Table('[table-name]').ba
我的网站正在使用 Django+Gunicorn+GEvent。 有一个功能,我必须将 Boto 用于 DynamoDB。 我需要调用monkey.patch_all() 来让Boto 变成green
我不断从包含在结构任务中的 boto create_launch_configuration() cmd 返回此错误。 这是命令: if user_data != '': security_group
我想使用 boto 获取 LoadBalancer 上的所有实例,我该如何实现? 这是我到目前为止所得到的: import boto from boto.regioninfo import Regio
标题已经说明问题了。 我正在请求一个带有 boto 的 Spot 实例,如下所示(aws key 和 secret key 是 ~/.boto 中设置的环境变量): import boto conn
我有一个我注册为亚马逊开发者的账户。 (我们称其为 developer 帐户) 我有另一个账户,我将其视为卖家账户(也是亚马逊开发者账户)。 (我们称此为seller 帐户) 我希望我的开发者帐户代表
如果存储桶名称有大写字母,我将无法连接到存储桶。 我有几个桶,里面有大写字母。 >>> mybucket = conn.get_bucket('Vig_import') Traceback (most
Boto在AWS上下文中代表什么?选择api名称似乎是一个随意的单词。是缩写吗?我已尝试使用Google搜索功能,但未发现其含义。 最佳答案 Boto的名称源于对亚马逊河原生海豚类型的葡萄牙语名称。
我是一名优秀的程序员,十分优秀!