Re: [python-win32] regarding invoking command prompt using python

2009-06-18 Thread Greg Ewing
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 o

Re: [python-win32] regarding invoking command prompt using python

2009-06-18 Thread Vernon Cole
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 wrote:

Re: [python-win32] regarding invoking command prompt using python

2009-06-18 Thread King Simon-NFHD78
bject: Re: [python-win32] regarding 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'] =

Re: [python-win32] regarding invoking command prompt using python

2009-06-18 Thread Tim Roberts
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. ___

Re: [python-win32] regarding invoking command prompt using python

2009-06-18 Thread Tim Roberts
Vernon Cole wrote: > Tim: > Okay, explain this... > C:\BZR\sterling\HL7>c:\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','

Re: [python-win32] regarding invoking command prompt using python

2009-06-18 Thread Vernon Cole
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 wrote: > Vernon Cole wrote: > >> Tim: >> Okay, explain this... >> C:\BZR\sterling\HL7>c:\python26\python.exe >> Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02)

[python-win32] regarding invoking command prompt using python

2009-06-17 Thread Roger Upole
Vernon Cole wrote: Tim: Okay, explain this... C:\BZR\sterling\HL7>c:\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

Re: [python-win32] regarding invoking command prompt using python

2009-06-17 Thread Vernon Cole
Tim: Okay, explain this... C:\BZR\sterling\HL7>c:\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 >

Re: [python-win32] regarding invoking command prompt using python

2009-06-17 Thread Tim Roberts
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

Re: [python-win32] regarding invoking command prompt using python

2009-06-17 Thread Tim Roberts
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

Re: [python-win32] regarding invoking command prompt using python

2009-06-17 Thread Philip Bloom
=crystald@python.org [mailto:python-win32-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 quest

Re: [python-win32] regarding invoking command prompt using python

2009-06-17 Thread Vernon Cole
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

Re: [python-win32] regarding invoking command prompt using python

2009-06-17 Thread Tim Roberts
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 buil

Re: [python-win32] regarding invoking command prompt using python

2009-06-17 Thread bob gailer
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

Re: [python-win32] regarding invoking command prompt using python

2009-06-17 Thread Gerdus van Zyl
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 u

[python-win32] regarding invoking command prompt using python

2009-06-17 Thread a h
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 th