sqlite3 error on AWS lambda with Python 3

后端 未结 7 1113
终归单人心
终归单人心 2021-02-01 05:07

I am building a python 3.6 AWS Lambda deploy package and was facing an issue with SQLite.

In my code I am using nltk which has a

7条回答
  •  野性不改
    2021-02-01 05:38

    From AusIV's answer, This version works for me in AWS Lambda and NLTK, I created a dummysqllite file to mock the required references.

    spec = importlib.util.spec_from_file_location("_sqlite3","/dummysqllite.py")
    sys.modules["_sqlite3"] = importlib.util.module_from_spec(spec)
    sys.modules["sqlite3"] = importlib.util.module_from_spec(spec)
    sys.modules["sqlite3.dbapi2"] = importlib.util.module_from_spec(spec)
    

提交回复
热议问题