So -- is there an api call which DOES actually place the value in
os.environ?
--
Vernon
On Wed, Jun 17, 2009 at 11:56 PM, Roger Upole rwup...@msn.com wrote:
Vernon Cole wrote:
Tim:
Okay, explain this...
C:\BZR\sterling\HL7c:\python26\python.exe
Python 2.6.2 (r262:71605, Apr 14 2009,
Vernon Cole wrote:
Thanks, Tim!
Should this be logged against the standard library as a bug?
Nope. It's actually the documented behavior. See section 16.1.1 here:
http://docs.python.org/library/os.html
--
Tim Roberts, t...@probo.com
Providenza Boekelheide, Inc.
invoking command prompt
using python
So -- is there an api call which DOES actually place the
value in os.environ?
--
Vernon
I think you should just set the value in os.environ:
In [1]: import os
In [2]: os.environ['abc'] = 'def'
In [3]: os.getenv('abc')
Out[3]: 'def'
In [4]: os.environ
Tim:
Geesh! I've read that umpteen times and never groked it. I guess an
important footnote of R.T.F.M. is UNDERSTAND
The Fine Manual. Thanks again for your better explanation. I will use it in
the book, if God and you are willing.
--
Vernon
On Thu, Jun 18, 2009 at 11:15 AM, Tim Roberts
Tim Roberts wrote:
Depending on your point of view, that's either a usage problem or a
design flaw in the os module.
The design of the os module does seem rather screwy in this
area. Since os.environ is a custom mapping type, I don't
know why it doesn't just pass all get and set operations on
Hi all
1.I want to know how do i write batchfile kind of file in python so that it
executes some commands. Code snippets are required.
2.As well how do i invoke command prompt.
Actually what i need is that i have to perform certain things in
windows...first i have to go to start-run-type cmd
1)
filename = C:/Program Files (x86)/NSIS/makensisw.exe
doc = install.nsi
status = os.system('%s %s' % (filename, doc))
print Status: , status
If you have long running program you want the output from there are
other options but the above is easiest imho.
2) just open the python file using the
a h wrote:
Hi all
1.I want to know how do i write batchfile kind of file in python so
that it executes some commands. Code snippets are required.
import os
os.system(command)
e.g. os.system( c:\temp_folder\next_folder\test.exe)
2.As well how do i invoke command prompt.
Not sure what
a h wrote:
thanks for the reply, what i have done to set up the environment
variables is open the command prompt and then has given the whole path
of c:\..\vsvars32.bat and then enter.
A message appear is setting environment for using MS visual studio.
and then using DEVENV i had build my
Everyone:
If I read the request correctly, this question is about how to set
environment variables from a python script.
In other words: what is the Python equivalent of the DOS command:
SET envrmnt=This is the new value
If my experience is correct (I would love it if someone will tell me that I
-bounces+pbloom=crystald@python.org] On Behalf
Of Vernon Cole
Sent: Wednesday, June 17, 2009 1:54 PM
To: Python-Win32 List
Subject: Re: [python-win32] regarding invoking command prompt using
python
Everyone:
If I read the request correctly, this question is about how to set
environment variables
Vernon Cole wrote:
If I read the request correctly, this question is about how to set
environment variables from a python script.
In other words: what is the Python equivalent of the DOS command:
SET envrmnt=This is the new value
Well, his question was a bit different, but this is part of
Vernon Cole wrote:
Similarly, it seems that getenv() and putenv() should be inverse
functions, but they are not. os.getenv() refers to the parent
environment, os.putenv() refers to the child environment.
No, no, no! That's not true at all! BOTH of those functions refer to
the environment of
Tim:
Okay, explain this...
C:\BZR\sterling\HL7c:\python26\python.exe
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]
on
win32
Type help, copyright, credits or license for more information.
import os
os.putenv('x','test')
print os.getenv('x')
zzz
exit()
Vernon Cole wrote:
Tim:
Okay, explain this...
C:\BZR\sterling\HL7c:\python26\python.exe
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)]
on
win32
Type help, copyright, credits or license for more information.
import os
os.putenv('x','test')
print os.getenv('x')
15 matches
Mail list logo