Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="os-newstreams.html" /> | |
13 | <link rel="prev" href="module-os.html" /> | |
14 | <link rel="parent" href="module-os.html" /> | |
15 | <link rel="next" href="os-newstreams.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>6.1.1 Process Parameters </title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="6.1 os " | |
25 | href="module-os.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="6.1 os " | |
28 | href="module-os.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="6.1.2 File Object Creation" | |
31 | href="os-newstreams.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="module-os.html">6.1 os </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="module-os.html">6.1 os </A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="os-newstreams.html">6.1.2 File Object Creation</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H2><A NAME="SECTION008110000000000000000"></A><A NAME="os-procinfo"></A> | |
56 | <BR> | |
57 | 6.1.1 Process Parameters | |
58 | </H2> | |
59 | ||
60 | <P> | |
61 | These functions and data items provide information and operate on the | |
62 | current process and user. | |
63 | ||
64 | <P> | |
65 | <dl><dt><b><tt id='l2h-1508' xml:id='l2h-1508'>environ</tt></b></dt> | |
66 | <dd> | |
67 | A mapping object representing the string environment. For example, | |
68 | <code>environ['HOME']</code> is the pathname of your home directory (on some | |
69 | platforms), and is equivalent to <code>getenv("HOME")</code> in C. | |
70 | ||
71 | <P> | |
72 | This mapping is captured the first time the <tt class="module">os</tt> module is | |
73 | imported, typically during Python startup as part of processing | |
74 | <span class="file">site.py</span>. Changes to the environment made after this time are | |
75 | not reflected in <code>os.environ</code>, except for changes made by modifying | |
76 | <code>os.environ</code> directly. | |
77 | ||
78 | <P> | |
79 | If the platform supports the <tt class="function">putenv()</tt> function, this | |
80 | mapping may be used to modify the environment as well as query the | |
81 | environment. <tt class="function">putenv()</tt> will be called automatically when | |
82 | the mapping is modified. | |
83 | <span class="note"><b class="label">Note:</b> | |
84 | Calling <tt class="function">putenv()</tt> directly does not change | |
85 | <code>os.environ</code>, so it's better to modify <code>os.environ</code>.</span> | |
86 | <span class="note"><b class="label">Note:</b> | |
87 | On some platforms, including FreeBSD and Mac OS X, setting | |
88 | <code>environ</code> may cause memory leaks. Refer to the system documentation | |
89 | for <tt class="cfunction">putenv()</tt>.</span> | |
90 | ||
91 | <P> | |
92 | If <tt class="function">putenv()</tt> is not provided, a modified copy of this mapping | |
93 | may be passed to the appropriate process-creation functions to cause | |
94 | child processes to use a modified environment. | |
95 | ||
96 | <P> | |
97 | If the platform supports the <tt class="function">unsetenv()</tt> function, you can | |
98 | delete items in this mapping to unset environment variables. | |
99 | <tt class="function">unsetenv()</tt> will be called automatically when an item is | |
100 | deleted from <code>os.environ</code>. | |
101 | ||
102 | <P> | |
103 | </dd></dl> | |
104 | ||
105 | <P> | |
106 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
107 | <td><nobr><b><tt class="function">chdir</tt></b>(</nobr></td> | |
108 | <td><var>path</var>)</td></tr></table></dt> | |
109 | <dd> | |
110 | <dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
111 | <td><nobr><b><tt class="function">fchdir</tt></b>(</nobr></td> | |
112 | <td><var>fd</var>)</td></tr></table></dt> | |
113 | <dd><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
114 | <td><nobr><b><tt class="function">getcwd</tt></b>(</nobr></td> | |
115 | <td><var></var>)</td></tr></table></dt> | |
116 | <dd>These functions are described in ``Files and Directories'' (section | |
117 | <A href="os-file-dir.html#os-file-dir">6.1.4</A>). | |
118 | </dl> | |
119 | ||
120 | <P> | |
121 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
122 | <td><nobr><b><tt id='l2h-1509' xml:id='l2h-1509' class="function">ctermid</tt></b>(</nobr></td> | |
123 | <td><var></var>)</td></tr></table></dt> | |
124 | <dd> | |
125 | Return the filename corresponding to the controlling terminal of the | |
126 | process. | |
127 | Availability: <span class="Unix">Unix</span>. | |
128 | </dl> | |
129 | ||
130 | <P> | |
131 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
132 | <td><nobr><b><tt id='l2h-1510' xml:id='l2h-1510' class="function">getegid</tt></b>(</nobr></td> | |
133 | <td><var></var>)</td></tr></table></dt> | |
134 | <dd> | |
135 | Return the effective group id of the current process. This | |
136 | corresponds to the `set id' bit on the file being executed in the | |
137 | current process. | |
138 | Availability: <span class="Unix">Unix</span>. | |
139 | </dl> | |
140 | ||
141 | <P> | |
142 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
143 | <td><nobr><b><tt id='l2h-1511' xml:id='l2h-1511' class="function">geteuid</tt></b>(</nobr></td> | |
144 | <td><var></var>)</td></tr></table></dt> | |
145 | <dd> | |
146 | <a id='l2h-1541' xml:id='l2h-1541'></a> | |
147 | Return the current process' effective user id. | |
148 | Availability: <span class="Unix">Unix</span>. | |
149 | </dl> | |
150 | ||
151 | <P> | |
152 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
153 | <td><nobr><b><tt id='l2h-1512' xml:id='l2h-1512' class="function">getgid</tt></b>(</nobr></td> | |
154 | <td><var></var>)</td></tr></table></dt> | |
155 | <dd> | |
156 | <a id='l2h-1542' xml:id='l2h-1542'></a> | |
157 | Return the real group id of the current process. | |
158 | Availability: <span class="Unix">Unix</span>. | |
159 | </dl> | |
160 | ||
161 | <P> | |
162 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
163 | <td><nobr><b><tt id='l2h-1513' xml:id='l2h-1513' class="function">getgroups</tt></b>(</nobr></td> | |
164 | <td><var></var>)</td></tr></table></dt> | |
165 | <dd> | |
166 | Return list of supplemental group ids associated with the current | |
167 | process. | |
168 | Availability: <span class="Unix">Unix</span>. | |
169 | </dl> | |
170 | ||
171 | <P> | |
172 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
173 | <td><nobr><b><tt id='l2h-1514' xml:id='l2h-1514' class="function">getlogin</tt></b>(</nobr></td> | |
174 | <td><var></var>)</td></tr></table></dt> | |
175 | <dd> | |
176 | Return the name of the user logged in on the controlling terminal of | |
177 | the process. For most purposes, it is more useful to use the | |
178 | environment variable <a class="envvar" id='l2h-1543' xml:id='l2h-1543'>LOGNAME</a> to find out who the user is, | |
179 | or <code>pwd.getpwuid(os.getuid())[0]</code> to get the login name | |
180 | of the currently effective user ID. | |
181 | Availability: <span class="Unix">Unix</span>. | |
182 | </dl> | |
183 | ||
184 | <P> | |
185 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
186 | <td><nobr><b><tt id='l2h-1515' xml:id='l2h-1515' class="function">getpgid</tt></b>(</nobr></td> | |
187 | <td><var>pid</var>)</td></tr></table></dt> | |
188 | <dd> | |
189 | Return the process group id of the process with process id <var>pid</var>. | |
190 | If <var>pid</var> is 0, the process group id of the current process is | |
191 | returned. Availability: <span class="Unix">Unix</span>. | |
192 | ||
193 | <span class="versionnote">New in version 2.3.</span> | |
194 | ||
195 | </dl> | |
196 | ||
197 | <P> | |
198 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
199 | <td><nobr><b><tt id='l2h-1516' xml:id='l2h-1516' class="function">getpgrp</tt></b>(</nobr></td> | |
200 | <td><var></var>)</td></tr></table></dt> | |
201 | <dd> | |
202 | <a id='l2h-1544' xml:id='l2h-1544'></a> | |
203 | Return the id of the current process group. | |
204 | Availability: <span class="Unix">Unix</span>. | |
205 | </dl> | |
206 | ||
207 | <P> | |
208 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
209 | <td><nobr><b><tt id='l2h-1517' xml:id='l2h-1517' class="function">getpid</tt></b>(</nobr></td> | |
210 | <td><var></var>)</td></tr></table></dt> | |
211 | <dd> | |
212 | <a id='l2h-1545' xml:id='l2h-1545'></a> | |
213 | Return the current process id. | |
214 | Availability: <span class="Unix">Unix</span>, Windows. | |
215 | </dl> | |
216 | ||
217 | <P> | |
218 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
219 | <td><nobr><b><tt id='l2h-1518' xml:id='l2h-1518' class="function">getppid</tt></b>(</nobr></td> | |
220 | <td><var></var>)</td></tr></table></dt> | |
221 | <dd> | |
222 | <a id='l2h-1546' xml:id='l2h-1546'></a> | |
223 | Return the parent's process id. | |
224 | Availability: <span class="Unix">Unix</span>. | |
225 | </dl> | |
226 | ||
227 | <P> | |
228 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
229 | <td><nobr><b><tt id='l2h-1519' xml:id='l2h-1519' class="function">getuid</tt></b>(</nobr></td> | |
230 | <td><var></var>)</td></tr></table></dt> | |
231 | <dd> | |
232 | <a id='l2h-1547' xml:id='l2h-1547'></a> | |
233 | Return the current process' user id. | |
234 | Availability: <span class="Unix">Unix</span>. | |
235 | </dl> | |
236 | ||
237 | <P> | |
238 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
239 | <td><nobr><b><tt id='l2h-1520' xml:id='l2h-1520' class="function">getenv</tt></b>(</nobr></td> | |
240 | <td><var>varname</var><big>[</big><var>, value</var><big>]</big><var></var>)</td></tr></table></dt> | |
241 | <dd> | |
242 | Return the value of the environment variable <var>varname</var> if it | |
243 | exists, or <var>value</var> if it doesn't. <var>value</var> defaults to | |
244 | <code>None</code>. | |
245 | Availability: most flavors of <span class="Unix">Unix</span>, Windows. | |
246 | </dl> | |
247 | ||
248 | <P> | |
249 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
250 | <td><nobr><b><tt id='l2h-1521' xml:id='l2h-1521' class="function">putenv</tt></b>(</nobr></td> | |
251 | <td><var>varname, value</var>)</td></tr></table></dt> | |
252 | <dd> | |
253 | <a id='l2h-1548' xml:id='l2h-1548'></a> | |
254 | Set the environment variable named <var>varname</var> to the string | |
255 | <var>value</var>. Such changes to the environment affect subprocesses | |
256 | started with <tt class="function">os.system()</tt>, <tt class="function">popen()</tt> or | |
257 | <tt class="function">fork()</tt> and <tt class="function">execv()</tt>. | |
258 | Availability: most flavors of <span class="Unix">Unix</span>, Windows. | |
259 | ||
260 | <P> | |
261 | <span class="note"><b class="label">Note:</b> | |
262 | On some platforms, including FreeBSD and Mac OS X, | |
263 | setting <code>environ</code> may cause memory leaks. | |
264 | Refer to the system documentation for putenv.</span> | |
265 | ||
266 | <P> | |
267 | When <tt class="function">putenv()</tt> is | |
268 | supported, assignments to items in <code>os.environ</code> are automatically | |
269 | translated into corresponding calls to <tt class="function">putenv()</tt>; however, | |
270 | calls to <tt class="function">putenv()</tt> don't update <code>os.environ</code>, so it is | |
271 | actually preferable to assign to items of <code>os.environ</code>. | |
272 | </dl> | |
273 | ||
274 | <P> | |
275 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
276 | <td><nobr><b><tt id='l2h-1522' xml:id='l2h-1522' class="function">setegid</tt></b>(</nobr></td> | |
277 | <td><var>egid</var>)</td></tr></table></dt> | |
278 | <dd> | |
279 | Set the current process's effective group id. | |
280 | Availability: <span class="Unix">Unix</span>. | |
281 | </dl> | |
282 | ||
283 | <P> | |
284 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
285 | <td><nobr><b><tt id='l2h-1523' xml:id='l2h-1523' class="function">seteuid</tt></b>(</nobr></td> | |
286 | <td><var>euid</var>)</td></tr></table></dt> | |
287 | <dd> | |
288 | Set the current process's effective user id. | |
289 | Availability: <span class="Unix">Unix</span>. | |
290 | </dl> | |
291 | ||
292 | <P> | |
293 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
294 | <td><nobr><b><tt id='l2h-1524' xml:id='l2h-1524' class="function">setgid</tt></b>(</nobr></td> | |
295 | <td><var>gid</var>)</td></tr></table></dt> | |
296 | <dd> | |
297 | Set the current process' group id. | |
298 | Availability: <span class="Unix">Unix</span>. | |
299 | </dl> | |
300 | ||
301 | <P> | |
302 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
303 | <td><nobr><b><tt id='l2h-1525' xml:id='l2h-1525' class="function">setgroups</tt></b>(</nobr></td> | |
304 | <td><var>groups</var>)</td></tr></table></dt> | |
305 | <dd> | |
306 | Set the list of supplemental group ids associated with the current | |
307 | process to <var>groups</var>. <var>groups</var> must be a sequence, and each | |
308 | element must be an integer identifying a group. This operation is | |
309 | typical available only to the superuser. | |
310 | Availability: <span class="Unix">Unix</span>. | |
311 | ||
312 | <span class="versionnote">New in version 2.2.</span> | |
313 | ||
314 | </dl> | |
315 | ||
316 | <P> | |
317 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
318 | <td><nobr><b><tt id='l2h-1526' xml:id='l2h-1526' class="function">setpgrp</tt></b>(</nobr></td> | |
319 | <td><var></var>)</td></tr></table></dt> | |
320 | <dd> | |
321 | Calls the system call <tt class="cfunction">setpgrp()</tt> or <tt class="cfunction">setpgrp(0, | |
322 | 0)</tt> depending on which version is implemented (if any). See the | |
323 | <span class="Unix">Unix</span> manual for the semantics. | |
324 | Availability: <span class="Unix">Unix</span>. | |
325 | </dl> | |
326 | ||
327 | <P> | |
328 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
329 | <td><nobr><b><tt id='l2h-1527' xml:id='l2h-1527' class="function">setpgid</tt></b>(</nobr></td> | |
330 | <td><var>pid, pgrp</var>)</td></tr></table></dt> | |
331 | <dd> Calls the system call | |
332 | <tt class="cfunction">setpgid()</tt> to set the process group id of the process with | |
333 | id <var>pid</var> to the process group with id <var>pgrp</var>. See the <span class="Unix">Unix</span> | |
334 | manual for the semantics. | |
335 | Availability: <span class="Unix">Unix</span>. | |
336 | </dl> | |
337 | ||
338 | <P> | |
339 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
340 | <td><nobr><b><tt id='l2h-1528' xml:id='l2h-1528' class="function">setreuid</tt></b>(</nobr></td> | |
341 | <td><var>ruid, euid</var>)</td></tr></table></dt> | |
342 | <dd> | |
343 | Set the current process's real and effective user ids. | |
344 | Availability: <span class="Unix">Unix</span>. | |
345 | </dl> | |
346 | ||
347 | <P> | |
348 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
349 | <td><nobr><b><tt id='l2h-1529' xml:id='l2h-1529' class="function">setregid</tt></b>(</nobr></td> | |
350 | <td><var>rgid, egid</var>)</td></tr></table></dt> | |
351 | <dd> | |
352 | Set the current process's real and effective group ids. | |
353 | Availability: <span class="Unix">Unix</span>. | |
354 | </dl> | |
355 | ||
356 | <P> | |
357 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
358 | <td><nobr><b><tt id='l2h-1530' xml:id='l2h-1530' class="function">getsid</tt></b>(</nobr></td> | |
359 | <td><var>pid</var>)</td></tr></table></dt> | |
360 | <dd> | |
361 | Calls the system call <tt class="cfunction">getsid()</tt>. See the <span class="Unix">Unix</span> manual | |
362 | for the semantics. | |
363 | Availability: <span class="Unix">Unix</span>. | |
364 | <span class="versionnote">New in version 2.4.</span> | |
365 | ||
366 | </dl> | |
367 | ||
368 | <P> | |
369 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
370 | <td><nobr><b><tt id='l2h-1531' xml:id='l2h-1531' class="function">setsid</tt></b>(</nobr></td> | |
371 | <td><var></var>)</td></tr></table></dt> | |
372 | <dd> | |
373 | Calls the system call <tt class="cfunction">setsid()</tt>. See the <span class="Unix">Unix</span> manual | |
374 | for the semantics. | |
375 | Availability: <span class="Unix">Unix</span>. | |
376 | </dl> | |
377 | ||
378 | <P> | |
379 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
380 | <td><nobr><b><tt id='l2h-1532' xml:id='l2h-1532' class="function">setuid</tt></b>(</nobr></td> | |
381 | <td><var>uid</var>)</td></tr></table></dt> | |
382 | <dd> | |
383 | <a id='l2h-1549' xml:id='l2h-1549'></a> | |
384 | Set the current process' user id. | |
385 | Availability: <span class="Unix">Unix</span>. | |
386 | </dl> | |
387 | ||
388 | <P> | |
389 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
390 | <td><nobr><b><tt id='l2h-1533' xml:id='l2h-1533' class="function">strerror</tt></b>(</nobr></td> | |
391 | <td><var>code</var>)</td></tr></table></dt> | |
392 | <dd> | |
393 | Return the error message corresponding to the error code in | |
394 | <var>code</var>. | |
395 | Availability: <span class="Unix">Unix</span>, Windows. | |
396 | </dl> | |
397 | ||
398 | <P> | |
399 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
400 | <td><nobr><b><tt id='l2h-1534' xml:id='l2h-1534' class="function">umask</tt></b>(</nobr></td> | |
401 | <td><var>mask</var>)</td></tr></table></dt> | |
402 | <dd> | |
403 | Set the current numeric umask and returns the previous umask. | |
404 | Availability: <span class="Unix">Unix</span>, Windows. | |
405 | </dl> | |
406 | ||
407 | <P> | |
408 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
409 | <td><nobr><b><tt id='l2h-1535' xml:id='l2h-1535' class="function">uname</tt></b>(</nobr></td> | |
410 | <td><var></var>)</td></tr></table></dt> | |
411 | <dd> | |
412 | Return a 5-tuple containing information identifying the current | |
413 | operating system. The tuple contains 5 strings: | |
414 | <code>(<var>sysname</var>, <var>nodename</var>, <var>release</var>, <var>version</var>, | |
415 | <var>machine</var>)</code>. Some systems truncate the nodename to 8 | |
416 | characters or to the leading component; a better way to get the | |
417 | hostname is <tt class="function">socket.gethostname()</tt> | |
418 | <a id='l2h-1537' xml:id='l2h-1537'></a>or even | |
419 | <a id='l2h-1539' xml:id='l2h-1539'></a><code>socket.gethostbyaddr(socket.gethostname())</code>. | |
420 | Availability: recent flavors of <span class="Unix">Unix</span>. | |
421 | </dl> | |
422 | ||
423 | <P> | |
424 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
425 | <td><nobr><b><tt id='l2h-1540' xml:id='l2h-1540' class="function">unsetenv</tt></b>(</nobr></td> | |
426 | <td><var>varname</var>)</td></tr></table></dt> | |
427 | <dd> | |
428 | <a id='l2h-1550' xml:id='l2h-1550'></a> | |
429 | Unset (delete) the environment variable named <var>varname</var>. Such | |
430 | changes to the environment affect subprocesses started with | |
431 | <tt class="function">os.system()</tt>, <tt class="function">popen()</tt> or <tt class="function">fork()</tt> and | |
432 | <tt class="function">execv()</tt>. Availability: most flavors of <span class="Unix">Unix</span>, Windows. | |
433 | ||
434 | <P> | |
435 | When <tt class="function">unsetenv()</tt> is | |
436 | supported, deletion of items in <code>os.environ</code> is automatically | |
437 | translated into a corresponding call to <tt class="function">unsetenv()</tt>; however, | |
438 | calls to <tt class="function">unsetenv()</tt> don't update <code>os.environ</code>, so it is | |
439 | actually preferable to delete items of <code>os.environ</code>. | |
440 | </dl> | |
441 | ||
442 | <P> | |
443 | ||
444 | <DIV CLASS="navigation"> | |
445 | <div class='online-navigation'> | |
446 | <p></p><hr /> | |
447 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
448 | <tr> | |
449 | <td class='online-navigation'><a rel="prev" title="6.1 os " | |
450 | href="module-os.html"><img src='../icons/previous.png' | |
451 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
452 | <td class='online-navigation'><a rel="parent" title="6.1 os " | |
453 | href="module-os.html"><img src='../icons/up.png' | |
454 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
455 | <td class='online-navigation'><a rel="next" title="6.1.2 File Object Creation" | |
456 | href="os-newstreams.html"><img src='../icons/next.png' | |
457 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
458 | <td align="center" width="100%">Python Library Reference</td> | |
459 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
460 | href="contents.html"><img src='../icons/contents.png' | |
461 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
462 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
463 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
464 | <td class='online-navigation'><a rel="index" title="Index" | |
465 | href="genindex.html"><img src='../icons/index.png' | |
466 | border='0' height='32' alt='Index' width='32' /></A></td> | |
467 | </tr></table> | |
468 | <div class='online-navigation'> | |
469 | <b class="navlabel">Previous:</b> | |
470 | <a class="sectref" rel="prev" href="module-os.html">6.1 os </A> | |
471 | <b class="navlabel">Up:</b> | |
472 | <a class="sectref" rel="parent" href="module-os.html">6.1 os </A> | |
473 | <b class="navlabel">Next:</b> | |
474 | <a class="sectref" rel="next" href="os-newstreams.html">6.1.2 File Object Creation</A> | |
475 | </div> | |
476 | </div> | |
477 | <hr /> | |
478 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
479 | </DIV> | |
480 | <!--End of Navigation Panel--> | |
481 | <ADDRESS> | |
482 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
483 | </ADDRESS> | |
484 | </BODY> | |
485 | </HTML> |