Re: using subprocess.Popen env parameter

2010-03-04 Thread Nobody
On Wed, 03 Mar 2010 09:05:47 -0800, enda man wrote:

 cl_path = ms_vc_path + '\VC\bin'

The backslash is used as an escape character within string literals.
Either use raw strings:

cl_path = ms_vc_path + r'\VC\bin'

or escape the backslashes:

cl_path = ms_vc_path + '\\VC\\bin'

or use os.path.join():

cl_path = os.path.join(ms_vc_path, 'VC', 'bin')

-- 
http://mail.python.org/mailman/listinfo/python-list


using subprocess.Popen env parameter

2010-03-03 Thread enda man
Hi,

I want to use the env parameter to subprocess.Popen to pass in a path
to a location the process needs to run,
I do have a env variable already called MS_VC_PATH and I want to add
to it, not set up more in the PATH variable.

/
ms_vc_path=os.environ['MS_VC_PATH']
cl_path = ms_vc_path + '\VC\bin'
lib_vc_path = ms_vc_path + '\VC\lib'
myenv = os.environ
myenv[PATH] = cl_path + ; + lib_vc_path + ; + myenv[PATH]

subprocess.Popen(midl /D \_DEBUG\ /nologo /char signed /env win32 /
Oicf  /tlb \ActivexPlugin.tlb\ /h \ActivexPlugin_i.h\ /iid
\ActivexPlugin_i.c\ /proxy \ActivexPlugin_p.c\ /error stub_data
ActivexPlugin.idl, env=myenv)

///

but it seems that midl can not see the new path I am sending to it
using the env variable, am I using env correctly?

here is my output:
midl : command line error MIDL1005 : cannot find C preprocessor cl.exe

Any help?
EM
-- 
http://mail.python.org/mailman/listinfo/python-list