The parameters that I need to pass to my Python program use some environment variables.
This is how I run it on the terminal:
export BUCKET="/tmp/bucket"
python main.py --input $BUCKET/input --output $BUCKET/output
On PyCharm, I created a Run/Debug configuration with an environment variable called BUCKET
and passed the following string as parameters: --input $BUCKET/input --output $BUCKET/output
.
When PyCharm executes the program, it doesn't pick up the value of BUCKET
as /tmp/bucket
. It considers $BUCKET
to be a string.
I also tried using ${BUCKET}
instead of $BUCKET
but that doesn't work either.
Is there some way to pass variables?
Note: The reason I want to do this is that I have a large number of parameters in my real code. I have only provided a toy example above. I want to be able to update an environment variable only in one place.
I encountered the same problem a few days back. I found a plugin called EnvFile. Using this you can have an env file exported before running the script. After installing it, you'll get an extra tab EnvFile in your configuration. Select your environment file there. It is specific to the configuration. Now, every time you run the configuration environment variables will be exported. My .env file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With