IDLE Python and Environment Variables

Gabriel Genellina gagsl-py at
Thu Jan 11 06:32:49 CET 2007

At Wednesday 10/1/2007 23:24, Tristan wrote:

>1)      For almost everyone, I execute a corresponding ".bat file" into
>which I define and/or include values for some "temporal"
>environment variables that let me find all the objects that the
>selected application uses. Sometimes I include in the .bat file the
>execution of the application, but generally I leave in a prompt status,
>ready to invoke python or some dos commands.

What kind of environment variables? Those used by Python itself, like 
PYTHONPATH? Or your own variables, like FOO_LOCATION=C:\My\Projects\Lib\Foo

>2)      When I close the command prompt window, there are no traces of
>enviroment variables in my windows system (that is right). Only the
>default windows environment variables remain.
>I tried to do the same with the IDLE (and I imagine tha same occurs
>with Python command line), but I have the next problem:
>I can not find in IDLE (or another app?) the way to previously define
>and/or include automatically values for my "temporal" environment
>variables as I do in the .bat files.

So you write a .bat that:
- defines some variables
- calls your script.
It appears that your variables are some kind of configuration - in 
this case it has more sense to put such configuration in another 
place, like a config file, and forget about environment variables.
You can use the usual .ini Windows format and read it with 
ConfigParser. You can pass your script the name of the ini file to 
read - this would be the equivalent of using different .bat files to 
call the same script.
This way it doesn't matter whether you invoke your application using 
python command line, or inside IDLE, or inside another environment.

Gabriel Genellina
Softlab SRL 


Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 

More information about the Python-list mailing list