GoogleCloudPlatform / GoogleCloudPlatform/deploymentmanager-samples

The template produces different results with Python3 and Python2

Open
#519 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jinja
Stars
951
Forks
700
PR merge metrics
No merged PRs in 30d

Description

Hi,
I'm trying to apply this simple template Jinja:

```
{% set LIST_LABELS = env['project'].split('-') %}
{% set BASE_LABELS = dict() %}
{% set x=BASE_LABELS.__setitem__('application',LIST_LABELS[0].encode('utf-8')) %}
{% set x=BASE_LABELS.__setitem__('landscape',LIST_LABELS[1].encode('utf-8')) %}

- name: test
type: gcp-types/pubsub-v1:projects.topics
properties:
topic: test
labels: {{ BASE_LABELS }}
```

but gcloud command return the following error:

```
code: NOT_CRITICAL_ERROR
message: |-
The template produces different results with Python3 and Python2. This could be because of the non-determinism of your configuration, or a potential incompatibility with Python3. Make sure that your templates are compatible with Python3.
https://cloud.google.com/deployment-manager/docs/migrate-to-python3
```

How can I check the different results and resolve them?

OS/gcloud info:

```
$ system_profiler SPSoftwareDataType
Software:

System Software Overview:

System Version: macOS 10.14.6 (18G2022)
Kernel Version: Darwin 18.7.0
...

$ gcloud version
Google Cloud SDK 274.0.1
alpha 2019.05.17
app-engine-python 1.9.87
beta 2019.05.17
bq 2.0.51
cloud-datastore-emulator 2.1.0
cloud_sql_proxy
core 2019.12.27
datalab 20190610
docker-credential-gcr
gcloud
gsutil 4.46
kubectl 2019.11.04

```

Thanks you

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.