Linked Questions

Popular Questions

Pass a list from YAML file to python

Asked by At

I am creating a web application using googles app engine with the python 3.7 standard environment. I am passing values from the app.yaml file to my main script, however, I cannot seem to pass a list from the yaml file to the main file.

Here is my app.yaml file:

runtime: python37

handlers:
  # This configures Google App Engine to serve the files in the app's static
  # directory.
- url: /static
  static_dir: static


env_variables:
  USERS: '[email protected]'
  USERS2: ['[email protected]', '[email protected]']
  USERS3:
  - '[email protected]'
  - '[email protected]'
  USERS4:
    - '[email protected]'
    - '[email protected]'

Here is my python script:

import os

users = os.environ.get('USERS')
users2 = os.environ.get('USERS2')
users3 = os.environ.get('USERS3')
users4 = os.environ.get('USERS4')

The variable users returns '[email protected]' correctly. Though, users2, users3 and users4 all return [] (an empty list).

Related Questions