[python-win32] Loading C extensions in Python 2.6/2.7 from classic ASP

Chris Lambacher chris at kateandchris.net
Wed Sep 14 03:30:11 CEST 2011


In a basic test where all I do is:
<script language="python" runat="server">
import sys
Response.Write(sys.version)
</script>

It loads the following dlls:
c:\windows\wow64\python27.dll
c:\windows\wow64\pywintypes.dll
c:\windows\wow64\pythoncomloader.dll
c:\windows\pythoncom27.dll

It loads the following extensions:

c:\python27\lib\site-packages\win32\_win32sysloader.pyd
c:\python27\lib\site-packages\win32\win32api.pyd
c:\python27\lib\site-packages\win32\win32trace.pyd
c:\python27\lib\site-packages\win32comext\axscript\axscript.pyd
c:\python27\lib\site-packages\win32comext\axdebug\axdebug.pyd

and since they are already loaded, they continue to import without error.

I have not been able to trigger the issue with *any* C extension that
ships with Python or pywin32. But pretty much any extension that is
provided by a 3rd party gives me the DLL load failed :(

Maybe this is actually a Python bug. I don't know. It doesn't make any
sense. At least I have a work-around.

-Chris

On Tue, Sep 13, 2011 at 7:54 PM, Chris Lambacher <chris at kateandchris.net> wrote:
> I don't import anything from pywin32 other than what would have already been
> loaded before getting to my code by the pywin32 machinery that makes active
> scripting work. When I get back to my computer I'll look at what gets loaded
> in the most basic app and try to determine what loads those modules first.
>
> -Chris
>
> On Tuesday, September 13, 2011, mhammond at skippinet.com.au
> <mhammond at skippinet.com.au> wrote:
>> But none of pywin32, right? So the obvious question is still how those
>> other modules differ from pywin32
>> --
>> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>>
>> Chris Lambacher <chris at kateandchris.net> wrote:
>>>
>>> Basically every C extension I have ever tried:
>>>
>>> lxml
>>> pycrypto
>>> pyodbc
>>> psyco
>>>
>>> -Chris
>>>
>>> On Tue, Sep 13, 2011 at 1:30 PM, mhammond at skippinet.com.au
>>> <mhammond at skippinet.com.au> wrote:
>>> > What are the other modules? Is it just the etree one?
>>> >
>>> > Mark
>>> > --
>>> > Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>>> >
>>> > Chris Lambacher <chris at kateandchris.net> wrote:
>>> >>
>>> >> On Sun, Sep 11, 2011 at 3:42 PM, Mark Hammond
>>> >> <mhammond at skippinet.com.au>
>>> >> wrote:
>>> >> > The best I can suggest is to make a small .asp example which
>>> >> > requires
>>> >> > nothing beyond pywin32 - eg, some of the asp samples.  Once you are
>>> >> > convinced that works, I'd start looking into what is different about
>>> >> > the
>>> >> > lxml.etree
>>> module - I suspect you will find that module references the
>>> >> > CRT
>>> >> > assembly.
>>> >> >
>>> >>
>>> >> I was looking at something else in Process Explorer and noticed a pyd
>>> >> that was loaded in the standalone part of the app that I did not
>>> >> rebuild and wondered if it loaded correctly in the ASP app. In this
>>> >> case it was the _speedups.pyd extension of the markupsafe package and
>>> >> indeed when I look at the running w3p.exe process, I see the
>>> >> _speedups.pyd extension is loaded and modifying my test app to load
>>> >> the _speedups.pyd module and
>>> >> everything works.
>>> >>
>>> >> Maybe the other modules are loading other DLLs and therefore need the
>>> >> manifest in order to be able to inherit it since it is not the   main
>>> >> process loading the DLLs anymore?
>>> >>
>>> >> -Chris
>>> >>
>>> >>
>>> >> --
>>> >> Christopher Lambacher
>>> >> chris at kateandchris.net
>>> >
>>>
>>>
>>>
>>> --
>>> Christopher Lambacher
>>> chris at kateandchris.net <chris at kateandchris.net>
>>
>
> --
> Christopher Lambacher
> chris at kateandchris.net
>



-- 
Christopher Lambacher
chris at kateandchris.net


More information about the python-win32 mailing list