【发布时间】:2018-08-05 06:06:01
【问题描述】:
我在 AWS Lambda 上使用 Python 模块 googlesearch,但它抛出错误 - 我怀疑是因为它想根据 AWS Lambda 上不存在的文件夹结构将 cookie 写入磁盘。
另外,AWS Lambda 只允许写入 /tmp/
怎么办?我唯一能想到的就是从 github 下载模块代码并集成到我的 Python 脚本中——真的不想走那条路……
感谢您的建议...
这是 AWS Lambda 错误报告:
Errno 30] Read-only file system: './.google-cookie': OSError
Traceback (most recent call last):
File "/var/task/scriverto.py", line 176, in lambda_handler
url_list = generate_URL_list(query,n) #call URL generator routine in gsearch
File "/var/task/scriverto.py", line 58, in generate_URL_list
for url in search(query, tld = "co.uk", lang='en', pause = 2, stop=n):
#can also add tld to limit to country e.g. tld='uk
File "/var/task/googlesearch/__init__.py", line 330, in search
get_page(url_home % vars())
File "/var/task/googlesearch/__init__.py", line 151, in get_page
cookie_jar.save()
File "/var/lang/lib/python3.6/http/cookiejar.py", line 1875, in save
with open(filename, "w") as f:
OSError: [Errno 30] Read-only file system: './.google-cookie'
【问题讨论】:
标签: python python-3.x amazon-web-services aws-lambda google-search