title: Jenkins gcloud deployment causes ImportError
body: <p>I've set up a Jenkins instance in Google Compute Engine to build and deploy an App Engine Java project following <a href="https://cloud.google.com/tools/repo/push-to-deploy" rel="nofollow">this page from Google</a>.</p>
  
  <p>I've configured Jenkins to run the following shell command only when the Maven build succeeds: <code>gcloud --project=decent-ellipse-843 preview app deploy target/*-SNAPSHOT/</code></p>
  
  <p>When I attempt a build, the deployment fails with the following trace:</p>
  
  <pre><code>+ gcloud --project=decent-ellipse-843 preview app deploy target/backend-api-0.0.1-SNAPSHOT/
  Traceback (most recent call last):
    File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 183, in &lt;module&gt;
      main()
    File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 179, in main
      _cli.Execute()
    File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 488, in Execute
      post_run_hooks=self.__post_run_hooks)
    File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1016, in Run
      result = command_instance.Run(args)
    File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 86, in TryFunc
      return func(*args, **kwargs)
    File "/usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 158, in Run
      stage_dir = self.__MakeStagingDir(project, args, deployable)
    File "/usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 268, in __MakeStagingDir
      java_app_update = appcfg_java.JavaAppUpdate(deployable, args)
    File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 146, in __init__
      self.app_engine_web_xml = self._ReadAppEngineWebXml()
    File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 205, in _ReadAppEngineWebXml
      parser=app_engine_web_xml_parser.AppEngineWebXmlParser)
    File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 217, in _ReadAndParseXml
      return parser().ProcessXml(file_handle.read())
    File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/app_engine_web_xml_parser.py", line 71, in ProcessXml
      xml_root = ElementTree.fromstring(xml_str)
    File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML
      parser = XMLParser(target=TreeBuilder())
    File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1466, in __init__
      "No module named expat; use SimpleXMLTreeBuilder instead"
  ImportError: No module named expat; use SimpleXMLTreeBuilder instead
  Build step 'Execute shell' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>The Maven build is successful, and I can deploy the project by issuing the gcloud command manually.</p>
  
  <p>Even when I run the exact same <code>gcloud</code> command from the same directory and under the same user (<code>tomcat</code>), the deployment succeeds without errors.</p>
  
  <p>I have re-installed python and updated the Google Cloud SDK without any results. </p>
  
  <p>The instance is running Python 2.7.3, Jenkins 1.598, JDK 7u76 and Maven 3.2.2. </p>
  
  <p>I hope someone can help me out with this!</p>