I have added a zip file as an deployment package which includes an xxx.py script.
My lambda function should invoke xxx.py script from the package.
My lambda function as below:
libdir = os.path.join(os.getcwd(), 'local', 'lib')
download_path = '/tmp/{}{}'.format(uuid.uuid4(), key)
command = 'LD_LIBRARY_PATH={} python xxx.py "{}"'.format(libdir, download_path)
output_path = subprocess.check_output(command, shell=True)
I get this error:
Command 'LD_LIBRARY_PATH=/var/task/local/lib python xxx.py "/tmp/52513240-a9 returned non-zero exit status 2.: CalledProcessError
My deployment package has xxx.py file within few subfolders in the zip file.
Do I need to set environment variable in my lambda function? If yes, what could be the key and value in my case.
Is there any other way than this to call an python script from deployment package in lambda?
Please help. Thanks in advance!