python - Cannot use python-geoip with AWS Lambda
问题描述
Python-Geoip is a small package that allows free offline use of the MaxMind country database. It works fine locally, but I cannot get it working within AWS Lambda.
I created a deployment package with requests
, geoip
and geoip-geolite2
, but I am getting the following error message:
"errorMessage": "Unable to import module 'uploadXmlLog'"
If I comment out requests
I get the error message:
"errorMessage": "Cannot use packaged database \"geolite2\" because package \"_geoip_geolite2\" is not available. It's provided by PyPI package \"python-geoip-geolite2\""
Using requests
without geoip
works fine.
How can I resolve this?
解决方案
我的错,对不起。一些内部文件夹的内容未包含在部署包中。需要使用 'zip -r ...' 创建开发包。顺便说一句,由于 geoip db 部署包增加到 ~18 Mb 并且 AWS 不允许您在线编辑 python 文件。但工作正常。
推荐阅读
- css - 如何让视图以特定的间隔填充?
- c++ - 错误 LNK2001:未解析的外部符号“公共:__thiscall CDboTSTAgency::CDboTSTAgency(void)”
- payment-gateway - 如何在 Global Payments PHP API 中访问过去交易的状态?
- sql - 是否可以在 SQL 中使用数组元素作为外键?
- sql - 一次对多条记录使用更新查询
- python - TF 模型是否将 pandas.Categorical() 转换的特征视为分类?
- python - 为什么装饰器需要包装器
- javascript - svg下的图像标签中的过滤器会降低图像的质量吗?
- typescript - 打字稿:接口联盟
- reactjs - 如何确保整个应用都可以使用 Google 注销按钮