[python-win32] Getting PyWin32 working with private Python installs

Howard Lightstone howard at eegsoftware.com
Tue Apr 20 19:28:05 CEST 2010


On Tue, Apr 20, 2010 at 10:14 AM, Bill Janssen <janssen at parc.com> wrote:

> Howard Lightstone <howard at eegsoftware.com> wrote:
>
> > I've had a private Python25 install running with win32 for a while.  I
> > believe the trick is that the pythoncom25.dll and pywintypes25.dll have
> to
> > be in the SAME folder as the python.exe that you want to use (due to
> Windoze
> > own variety of internal search paths for DLLs).  In my code, I also alter
> > the PATH to point to both the DLLs and (root) folder where the python.exe
> > is.   I actually have an embedded interpreter in my instance with a
> > subfolder of the entire Python25 installation.  I am able to run the
> > python.exe and use the win32 code without changing any registry items on
> > machines that have never had Python installed.
>
> Thanks, Howard.  That's just what I want to do.
>
> Unfortunately, I've tried just that (I think) and it didn't work.  I
> install Python 2.6.5 "just for me" under a private directory
> (C:\UpLib\1.7.9\python), then I unzip the 2.6.5 version of pywin32 and
> put it in "the right place" (C:\UpLib\1.7.9\python\Lib\site-packages\).
> Then I copy the two pywin32 DLLs to the right place
> (C:\UpLib\1.7.9\python), just where the python.exe is.
>
> Then I set my path so that python.exe (and thus the two DLLs) are on it,
> and try running Python:
>
> $ python -i
> Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import win32api
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: DLL load failed: This application has failed to start because
> the application configuration is incorrect. Reinstalling the application may
> fix this problem.
> >>>
> $
>
> Here's what the assembly XML for Python (also in C:\UpLib\1.7.9\python)
> says:
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <!-- Copyright (c) Microsoft Corporation.  All rights reserved. -->
> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
>    <noInheritable/>
>    <assemblyIdentity
>        type="win32"
>        name="Microsoft.VC90.CRT"
>        version="9.0.21022.8"
>        processorArchitecture="x86"
>        publicKeyToken="1fc8b3b9a1e18e3b"
>    />
>    <file name="msvcr90.dll" /> <file name="msvcp90.dll" /> <file
> name="msvcm90.dll" />
> </assembly>
>
> Bill
>
>
> > --
> > Howard Lightstone
> > howard at eegsoftware.com
> > _______________________________________________
> > python-win32 mailing list
> > python-win32 at python.org
> > http://mail.python.org/mailman/listinfo/python-win32
>
>
I see (having just tried it again) that I seem to have ALSO copied the two
DLLs to the Pythonwin folder (in site-packages).  I am loading the
pywintypes25.dll from there but the pythoncom25.dll from the folder where
python.exe is (as reported by Process Explorer).  I guess (long ago) when I
was trying to get things working that I copied the DLLs everywhere.

-- 
Howard Lightstone
howard at eegsoftware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100420/10c91b1e/attachment-0001.html>


More information about the python-win32 mailing list