Google App引擎不支持文件I / O或其他低级库。
我希望能够在我的GAE项目中使用boto(1.9.167)库。
现在我遇到此错误:
(/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py:269)
Traceback (most recent call last):
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 311, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/a19f7fde5f64c33c/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/base/data/home/apps/s~my-project/app:v2-0-281.418863766814079756/main.py", line 20, in <module>
from project import (
File "/base/data/home/apps/s~my-project/app:v2-0-281.418863766814079756/src/project/upload_api.py", line 5, in <module>
import boto3
File "/base/data/home/apps/s~my-project/app:v2-0-281.418863766814079756/lib/boto3/__init__.py", line 16, in <module>
from boto3.session import Session
File "/base/data/home/apps/s~my-project/app:v2-0-281.418863766814079756/lib/boto3/session.py", line 17, in <module>
import botocore.session
File "/base/data/home/apps/s~my-project/app:v2-0-281.418863766814079756/lib/botocore/session.py", line 30, in <module>
import botocore.credentials
File "/base/data/home/apps/s~my-project/app:v2-0-281.418863766814079756/lib/botocore/credentials.py", line 774, in <module>
class ProcessProvider(CredentialProvider):
File "/base/data/home/apps/s~my-project/app:v2-0-281.418863766814079756/lib/botocore/credentials.py", line 778, in ProcessProvider
def __init__(self, profile_name, load_config, popen=subprocess.Popen):
AttributeError: 'module' object has no attribute 'Popen'
例如,是否可以跳过credentials
检查并因此绕过对Popen
的呼叫?
我的代码就是
s3_client = boto3.client('s3',
aws_access_key_id=access_key,
aws_secret_access_key=secret_key)
s3_client.generate_presigned_url(...)
不依赖于本地存储的任何文件。