python - add a new path to PTYHONPATH and use it for program that is doing it using NSIS -


platform: windows 7
python: 2.7.3

strcpy $network_path "\\someserver\network\path\here" detailprint "$\n" detailprint "setting paths required" push "setx pythonpath $network_path;$network_path\lib" call execute push '"c:\python27\python.exe" setup.py deploy' call execute  function execute     exch $0     # execution of command , return success or failure functionend 

this above compiled nsis installer , run on multiple machines.

problem "c:\python27\python.exe" setup.py deploy depends on $network_path successful execution.

first time when run it, $network_path appended pythonpath environmental variable, "c:\python27\python.exe" setup.py deploy fails new pythonpath effective either in new command prompt or in next run.

is there way make appended pythonpath effective in same run itself?

currently, running twice - once setting pythonpath , accepting failure, second time runs successfully.

another alternative approach tried - made 2 executables, 1 setting pythonpath , python script run. put both of them in batch script run.

but preference achieve whole of in 1 file , in 1 run.

you can update installers environment, inherited child processes:

system::call 'kernel32::setenvironmentvariable(t "pythonpath", t "$network_path;$network_path\lib")i.r0' ; $0 != "0" on success push '"c:\python27\python.exe" setup.py deploy' call execute 

Comments