[python-win32] SendMessageTimeout() ?

Tim Roberts timr at probo.com
Fri Jul 27 18:50:49 CEST 2007


Carl Karsten wrote:
> OT question,
> Should this effect the PATH in the shell that called addtopath.py?
>
> os.environ['PATH'] = os.environ['PATH'] + ';' + DirToAdd
>
> currently I have an inst.bat with lines like this:
>
> addtopath.py svn-win32-1.4.4\bin
> path %path%;"%ProgramFiles%\svn-win32-1.4.4\bin"
>
> Be nice to consolidate.
>   

Nope.  Many people find it counterintuitive, but it turns out to be very
difficult to change the environment of the program that calls you. 
Remember that the shell's environment is part of the shell's address
space, and you don't have any control over that.  Your process inherits
a COPY of that environment, and if you change your environment the
changes will propagate to your children, but when your process exits,
your changes disappear.

One trick I have seen that eliminates the duplication is to have
"addtopath.py" generate a batch file, so you do something like this:

    addtopath.py svn-win32-1.4.4\bin
    call makechanges.bat
    erase makechanges.bat

Then addtopath.py can write the appropriate PATH statement to
makechanges.bat.  For robustness, you could add this to the top:

    echo pause Someone forgot to create the batch file. >makechanges.bat

> and just in case I haven't hijacked my own thread enough:
> does
> pywin32-210.win32-py2.5.exe
> have any command line switches so I don't have to hit 'next next...'?
>   

I believe it is a standard MSI installer, and if so you should be able
to use the normal switches.  /q and /qn suppress the UI altogether. 
/qb- should display a basic UI but with no modal dialog boxes.  You may
need to experiment.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list