Jason Vondersmith Jason Vondersmith - 6 months ago 47
MySQL Question

Add python modules to Azure

When I run a python script that I set up on WebJobs in Azure - I get the following error:

import MySQLdb
ImportError: No module named MySQLdb
job failed due to exit code 1


I found some articles that seem to suggest to install python modules to a directory created on the webapp. How/Where would I install those modules?

Answer

Have you tried this?

http://nicholasjackson.github.io/azure/python/python-packages-and-azure-webjobs/ (from the site):

Step 1.

If you are using OSX and the default Python 2.7 install your packages installed with pip will be in /usr/local/lib/python2.7/site-packages, create a folder called site-packages in the root of your python job and copy any packages you need for your job into it.

Step 2

Next you need to modify your run.py or any other file which requires access to the package files. At the top of the file add….

import sys  
sys.path.append("site-packages")