0

I need to be able to create and download presentations using Django Python. I also need to use AppEngine standard. Currently I am using python-pptx but according to this SO answer it wont work. I get cannot import name etree or 'module' object has no attribute 'exc'.

Is there a way to make python-pptx work on GAE -this is the best option for me.

Or else, is there a way to make a presentation without python-pptx?

  • 1
    The answer you linked to is from 2015, and the current GAE appears to support lxml v3.7.3: https://cloud.google.com/appengine/docs/standard/python/tools/built-in-libraries-27. So either you're not accessing the right lxml version from those available on GAE or something else is going on. – scanny May 28 '18 at 21:42

1 Answers1

0

I've found that several libraries must be imported to make the pptx library work properly.

I. The first step is to import the pptx library to the project. to do so, import the pptx library follow these steps, replacing the with python-pptx

Therefore:

  1. Create the "lib" dir, in your app.yaml directory
  2. Install the pptx library there : pip install -t lib/ python-pptx
  3. In the directory of app.yaml, create a file called appengine_config.py
  4. Save this code in this file

    from google.appengine.ext import vendor
    vendor.add('lib')

  5. then the pptx library should be ready, but additional dependencies are still needed.

II. Add additional dependencies:

1.in the app.yaml file, add the following code:

libraries:
- name: lxml
  version: "3.7.3"
- name: PIL
  version: "1.1.7"

After this additions your app should not be missing the library anymore.

Ggrimaldo
  • 327
  • 1
  • 7