Z
Z
Zlobober2011-08-14 23:49:42
Python
Zlobober, 2011-08-14 23:49:42

os.putenv in Python3?

Operating system WinXP.
Dialogue with python3:

C:\Python32&gt;python<br/>
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on win<br/>
32<br/>
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br/>
&gt;&gt;&gt; import os<br/>
&gt;&gt;&gt; os.putenv('x', 'foo')<br/>
&gt;&gt;&gt; os.environ['y'] = 'bar'<br/>
&gt;&gt;&gt; ^Z<br/>
<br/>
C:\Python32&gt;set x<br/>
Переменная среды x не определена<br/>
<br/>
C:\Python32&gt;set y<br/>
Переменная среды y не определена<br/>

I want to create some environment variable and write some value to it, which should be saved after, for example, restarting the computer. As far as I understood, the above ways should achieve this effect. Did I understand it correctly? And if so, then CHADNT?
A related question: what is the best way to correct the PATH variable from the program, for example, in a python installer? So that its value is preserved after a reboot?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Grichenko, 2011-08-15
@Kalobok

lmgtfy.com/?q=Permanent+environment+variable+windows
The second link is the setx utility. Normal set works only within one process and its descendants.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question