"Unable to import module 'app': No module named 'app'"
nidhinnyc opened this issue · 2 comments
nidhinnyc commented
When I try to run lambda using the below command it gives the error unable to import the module. If I get inside the container and check the /var/task folder I can see the files in the folder.
command
docker run --rm -v /Users/nidhinsurendran/Dev/pythonsamaws:/var/task:ro,delegated lambci/lambda:python3.8 app.lambda_handler
Error
{"errorType":"Runtime.ImportModuleError","errorMessage":"Unable to import module 'app': No module named 'app'"}
Has anyone encountered this issue?
mhart commented
It doesn't look like you're mounting your hello_world
directory at /var/task
.
Lambda looks for the modules at the top-level.
So try:
docker run --rm -v \
/Users/nidhinsurendran/Dev/pythonsamaws/hello_world:/var/task:ro,delegated \
lambci/lambda:python3.8 \
app.lambda_handler