I have created a Deployment Package for AWS Lambda, written in Python 2.7. In the Python script, I use pypyodbc to connect to an external data source, using a User DNS that I have configured on my local machine. When I attempt to deploy the package, I get the following error:
module initialization error: 'ODBC Library is not found. Is LD_LIBRARY_PATH set?'
I created the package project-dir
using pip into a virtual environment. The package is arranged as follows:
/project-dir
__init__.py
PythonFileIWantToUse.py
pypyodbc.py
pypyodbc.pyc
/boto
/pypyodbc-1.3.3.dist-info
/other modules, etc.
I've tried adding
#Point Lambda to Required OBDC Directory
os.environ['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH'] + ':' + '/var/task/'
to MainPythonIWantToUse.py
above the lambda_handler function, and including odbc32.lib in the root directory, but I got the same error.
Any idea what I need to do? I configured a local ODBC in Windows, but I'm not sure what file(s) to put where for Lambda's Unix Environment to find them.
Edit: I've tried to include the elements of UnixODBC in the root directory as well, but this doesn't change the result.