PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, August 22, 2022

[FIXED] How to pass an environment variable as a command line parameter in Run/Debug configuration in PyCharm?

 August 22, 2022     environment-variables, pycharm, python     No comments   

Issue

I am trying to learn PyCharm, need to pass an environment variable as a command line parameter to my process, e.g. execute an equivalent of myScript.py -u $myVar on Linux, or myScript.py -u %myVar% on Windows.

How do I specify that in the PyCharm configuration? I don't want my script to depend on the name myVar, just on the content of that environment variable.


Solution

in PyCharm Run/Debug configuration for "Script Parameters:" Enter

-u ${myVar}

Note: This will work only for existing env. variables but not for env. variables that you set up in the PyCharm Run/Debug configuration. For that to work, you will need to look into "Before Launch" configuration



Answered By - Alok A
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing