Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 18732

The variable is returning empty in my Python script

$
0
0

I am working on a Python script and using GCP Cloud Build to run it. Instead of hardcoding some of the variables, I am trying to use a Cloud Build YAML file to define the variables there and then use them in my Python script. However, it keeps returning an empty string. Can you review the code and let me know why?

yaml file

 steps    args:  - 'python3'  - 'test.py'  - '--project=${_PROJECT_ID}'  - '--dataset=${_DATASET_ID}'  - '--table=${_TABLE_NAME}'substitutions:_PROJECT_ID: 'test1det'_DATASET_ID: 'testdataset'_TABLE_NAME: 'testtable'

python code test.py

def tst(    project_id: str=os.getenv('_PROJECT_ID', 'default_project_id'),    dataset_id: str=os.getenv('_DATASET_ID', 'default_dataset_id'),    table_name: str=os.getenv('_TABLE_NAME', 'default_table_name')):

Viewing all articles
Browse latest Browse all 18732

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>