From 5e56ef5b303e528fe9ed7f5aa06e1a7d4ce1100d Mon Sep 17 00:00:00 2001 From: Steve Beaumont Date: Sun, 31 Jan 2021 08:53:53 +0000 Subject: [PATCH] Update python-package.md I spent many hours tracking down why my Python modules were not importable. When I renamed the package folder in the console from A to B and back from B to A the issue resolved and this led me to the discovery that files and directories must be globally readable for the Lambda to run despite everything looking perfectly OK in the console. I think it is important to fix this flaw or let people know about it. --- doc_source/python-package.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc_source/python-package.md b/doc_source/python-package.md index d042952c..f3aa695c 100644 --- a/doc_source/python-package.md +++ b/doc_source/python-package.md @@ -62,6 +62,9 @@ To create or update a function with the Lambda API, create a deployment package } ``` +**Note** +In order for your Python modules can be imported at runtime, ensure the files in the zip produced are globally readable (o+r) and any directories are globally readable (o+x). + ## Updating a function with additional dependencies If your Lambda function depends on libraries other than the AWS SDK for Python \(Boto3\), install them to a local directory with [pip](https://pypi.org/project/pip/), and include them in your deployment package\. @@ -204,4 +207,4 @@ A library may appear in `site-packages` or `dist-packages` and the first folder "RevisionId": "5afdc7dc-2fcb-4ca8-8f24-947939ca707f", ... } - ``` \ No newline at end of file + ```