gpt4 book ai didi

python - 尝试从 lambda(python)访问 S3 时出错

转载 作者:行者123 更新时间:2023-12-04 13:17:42 24 4
gpt4 key购买 nike

我正在尝试从 lambda(zappa+flask+python) 访问 S3,

class Logicos ( ) :
def newlogics() :
s3 = boto3.resource('s3')
return "It's Working"

我在 s3 = boto3.resource('s3') 行收到以下错误:

1571927898414] File "/var/task/newlogic_serverless.py", line 34, in newlogics


[1571927898414] s3 = boto3.resource('s3')
[1571927898414] File "/var/runtime/boto3/__init__.py", line 100, in resource
[1571927898414] return _get_default_session().resource(*args, **kwargs)
[1571927898414] File "/var/runtime/boto3/session.py", line 389, in resource
[1571927898414] aws_session_token=aws_session_token, config=config)
[1571927898414] File "/var/runtime/boto3/session.py", line 263, in client
[1571927898414] aws_session_token=aws_session_token, config=config)
[1571927898414] File "/var/runtime/botocore/session.py", line 827, in create_client

[1571927898414] credentials = self.get_credentials()
[1571927898414] File "/var/runtime/botocore/session.py", line 426, in get_credentials
[1571927898414] 'credential_provider').load_credentials()
[1571927898414] File "/var/runtime/botocore/session.py", line 903, in get_component
[1571927898414] self._components[name] = factory()
[1571927898414] File "/var/runtime/botocore/session.py", line 145, in <lambda>
[1571927898414] lambda: botocore.credentials.create_credential_resolver(self))
[1571927898414] File "/var/runtime/botocore/credentials.py", line 70, in create_credential_resolver
[1571927898414] container_provider = ContainerProvider()
[1571927898414] File "/var/runtime/botocore/credentials.py", line 1789, in __init__
[1571927898414] fetcher = ContainerMetadataFetcher()
[1571927898414] File "/var/runtime/botocore/utils.py", line 1238, in __init__
[1571927898414] timeout=self.TIMEOUT_SECONDS
[1571927898414] File "/var/runtime/botocore/httpsession.py", line 179, in __init__
[1571927898414] self._manager = PoolManager(**self._get_pool_manager_kwargs())
[1571927898414] File "/var/runtime/botocore/httpsession.py", line 187, in _get_pool_manager_kwargs
[1571927898414] 'ssl_context': self._get_ssl_context(),
[1571927898414] File "/var/runtime/botocore/httpsession.py", line 196, in _get_ssl_context
[1571927898414] return create_urllib3_context()
[1571927898414] File "/var/runtime/botocore/httpsession.py", line 71, in create_urllib3_context
[1571927898414] context.options |= options
[1571927898414] File "/var/lang/lib/python3.7/ssl.py", line 518, in options
[1571927898414] super(SSLContext, SSLContext).options.__set__(self, value)
[1571927898414] File "/var/lang/lib/python3.7/ssl.py", line 518, in options
[1571927898414] super(SSLContext, SSLContext).options.__set__(self, value)
[1571927898414] File "/var/lang/lib/python3.7/ssl.py", line 518, in options
[1571927898414] super(SSLContext, SSLContext).options.__set__(self, value)
[1571927898414] [Previous line repeated 477 more times]
[1571927898414] RecursionError: maximum recursion depth exceeded while calling a Python object

但是,如果我在没有 zappa 的情况下运行同一行代码,它工作正常。

请帮忙解决这个问题

最佳答案

我已经安装了 gevent,这是导致错误的原因。卸载 gevent 后,它运行良好

关于python - 尝试从 lambda(python)访问 S3 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58544230/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com