using subprocess.Popen env parameter

enda man emannion at gmail.com
Wed Mar 3 18:05:47 CET 2010


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



More information about the Python-list mailing list