psycopg2 w/apache on win32 (Issue #20)

From: Jason Erickson <jerickso(at)stickpeople(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: psycopg2 w/apache on win32 (Issue #20)
Date: 2011-01-09 19:48:23
Message-ID: 20110109121100.H39273@stickpeople.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg


Since we have a mailing list back, I wanted to solicit input on an issue,
just to make sure there is not something I'm missing.

I've been working on a solution to the following issue:
http://psycopg.lighthouseapp.com/projects/62710/tickets/20

The problem is when using apache/mod_wsgi with python 2.6 and 2.7 on
windows, psycopg2 cannot be imported because it is unable to find the
visual C runtime DLL. This is because changes were made in the distutils
of python 2.6.4 and 2.7 that strips out the reference in the manifest to
the DLL.

This change made to distutils is documented here:
http://bugs.python.org/issue4120

The expectation is that the orginating EXE would load the visual C runtime
DLL, and therefor it would be mapped into memory for the extension. This
fails with apache, because apache is not built with VC 2008, so it does
not need the VC 2008 runtime library and knows nothing about it.

My solution is to re-insert the manifest after the build process. This
does feel somewhat 'wrong', as it is reversing the above change. But
loooking at extensions, pywin32 has the runtime library still embedded in
its extensions, so we would not be unique in that regards.

Based upon why the change was made in the first place, I believe that
psycopg would not function if ALL of the following were true:

* Python is used in an embedded situation (a C program linked to python)
* Python/app is NOT installed for all users (MSVC runtime libraries are
installed locally to app, not in windows directory)
* MSVC 2008 runtime libraries are NOT installed in the system folder
(C:\Windows\WinSxS).

So my question to you folks out there, is there anything wrong with my
thinking? Or is anyone using it the way I described that may break it for
them?

Thanks,

-jason

Browse psycopg by date

  From Date Subject
Next Message W. Matthew Wilson 2011-01-09 19:58:10 I want the restructured text for the docs
Previous Message Jason Erickson 2011-01-09 19:10:55 Re: how to compile psycopg2 on windows?