[python-win32] Building msi with python 2.6.2

Roberto Aguilar bertosmailbox at gmail.com
Tue Jun 23 02:09:11 CEST 2009


On Jun 16, 2009, at 1:41 AM, Mark Hammond wrote:
> On 16/06/2009 12:40 PM, Roberto Aguilar wrote:
>> Hello everyone,
>>
>> I've been able to successfully build a MSI of pywin32 under Python
>> 2.6.2. But, when trying to use python, e.g. "import win32api", after
>> installing the MSI I get:
>>
>> ImportError: DLL load failed: The specified module could not be  
>> found.
>>
>> With the help of a colleague, I discovered the problem is due to  
>> python
>> not finding pywintypes26.dll. This file was installed by the MSI.  
>> It's in:
>>
>> C:\Python26\Lib\site-packages\pywin32_system32
>>
>> but that location is not being searched when importing.
>>
>> I can either:
>>
>> - set PATH=c:\Python26\Lib\site-packages\pywin32_system32;%PATH%
>> - then importing win32api works fine.
>>
>> or
>>
>> - move pywintypes26.dll to c:\Python26\Lib\site-packages\win32
>> - then importing win32api works fine.
>
> Or arrange to execute 'pywin32-postinstall.py -install' at the end  
> of the install, which will copy those files somewhere suitable  
> (either system32, or to the python dir).
>
> I'd be happy to make that script friendlier for MSI if necessary  
> (and hopefully you will contribute the MSI process back to pywin32 ;)

Thanks for the tip, Mark.  I discovered that pywin32_postinstall.py  
was being run during the bdist_msi command and it would error out when  
run during the msi installation.

Turns out that the MSI installer does not pass the -install argument.   
Instead it just runs the command with no arguments, which was simply  
printing out the usage.  I removed running it for bdist_msi command  
since it should only run when actually installing the msi.

To fix the msi installation part, I generate an msi-specific pywin32- 
postinstall script (pywin32_msi_postinstall.py) which simply replaces  
the contents of if __name__ == '__main__' with install().  That file  
is then added to the MSI package.

There might be a better approach to this, but I'm attaching a patch  
with my changes in case they are useful.

Thanks,
-berto.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pywin32_setup.patch
Type: application/octet-stream
Size: 2390 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090622/dd3302fb/attachment.obj>
-------------- next part --------------





More information about the python-win32 mailing list