[python-win32] can't import dde module after importing win32ui

Robert kxroberto at googlemail.com
Mon Nov 7 01:28:19 CET 2011


Robert wrote:
> Robert wrote:
>> Mark Hammond wrote:
>>>
>>> It will be something to do with the manifest and the mfc
>>> libraries. I think that even though the mfc dlls are installed
>>> with pywin32, it might not work as hoped :) Can you find a
>>> redistributable version of the MFC dlls you can try? I can't
>>> explain why the 32 vs 64bit versions behave differently other than
>>> what libraries are already installed.
>>>
>>> Sorry, not much help...
>>>
>>
>> same problem here.
>>
>> Well, the problem seems not to be 64bit specific. But is with
>> build 216 and 215 on 32bit as well; and with all Python versions.
>> Something changed critically with 215 build.
>>
>> The problem is not when starting through Pythinwin.exe (IDE), but
>> only when starting with python(w).exe + win32ui
>> (Even when the Pythonwin IDE is raise sucessfully through a script
>> on python(w).exe, the problem is there)
>>
>> Is there a special manifest in Pythonwin.exe ?
>>
>
>
> notized: I remove just mfc90.dll from the Pythonwin folder, and
> then do python.exe:
>
> C:\Python26\Lib\site-packages\pythonwin>\python26\python
> Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more
> information.
>  >>> import win32ui
>  >>> win32ui.GetApp()
> object 'PyCWinApp' - assoc is 00BBC728, vi=<None>, notify=0,ch/u=0/0
>  >>> import dde
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: DLL load failed: Das angegebene Modul wurde nicht
> gefunden. (module not found)
>  >>>
>
>
> => dde relies on the mfc90.dll in the same folder, but
> win32ui(.GetApp()) not !?
>
>
> And: with that removed mfc90.dll I can yet start the Pythonwin.exe
> of that very same folder AND successfully import dde !:
> PythonWin 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32
> bit (Intel)] on win32.
> Portions Copyright 1994-2008 Mark Hammond - see 'Help/About
> PythonWin' for further copyright information.
>  >>> import dde
>  >>> os.getcwd()
> 'C:\\Python26\\Lib\\site-packages\\pythonwin'
>  >>> dde
> <module 'dde' from 'dde.pyd'>
>  >>>
>
>
> => This time starting through Pythonwin.exe the same dde.pyd
> doesn't require the mfc90.dll in that folder! (I can even remove
> the other 3 mfc dlls too)
>
> => There is a strange mixup of mfc DLL dependencies, varying with
> the initial .exe
>
> There are also 2 different dates of the 4 MFC dlls here (in a very
> strange cross over order):
>
> 26.02.2011 18:43 48.640 dde.pyd
> 04.11.2011 11:57 1.156.600 mfc90.dll
> 07.11.2007 02:19 1.162.744 mfc90u.dll
> 06.11.2007 23:51 59.904 mfcm90.dll
> 04.11.2011 11:57 59.904 mfcm90u.dll
> 04.11.2011 11:57 548 Microsoft.VC90.MFC.manifest
> 19.08.2010 14:56 354.304 pythoncom26.dll
> 26.02.2011 18:43 19.968 Pythonwin.exe
> 19.08.2010 14:56 110.592 pywintypes26.dll
> 26.02.2011 18:42 778.240 win32ui.pyd
> 26.02.2011 18:42 37.888 win32uiole.pyd
> 11 Datei(en) 3.789.332 Bytes
> 2 Verzeichnis(se), 43.639.382.016 Bytes frei
>
>
> I tried to copy various mfc90 DLL's (4 of same date; e.g.
> 18.4.2011) from WinSxS and also from pythonwin-212 to the 216
> pythonwin folder , but that still didn't solve the dde import
> problem in 216 when starting through python(w).exe
>
> any ideas?
>
>


now I extracted the manifest from Pythonwin.exe with

win32api.LoadResource(None, 24, 1)

and saved it as python.exe.manifest   (or myapp.exe.manifest) next 
to the used python.exe
(-> see attachment)

and then "import win32ui, dde" works with that python.exe !


Seen in 216:

* win32ui.pyd has a internal manifest (extracted in attachment: 
contains only the MFC section)

* dde.pyd doesn't have a internal manifest!

In the pythonwin folder there is a Microsoft.VC90.MFC.manifest 
with matching version, though the local MFC DLLs and manifest seem 
not to be used at all now with that python.exe.manifest.
and never were used with Pythonwin.exe.


So how does this sort out? and how to explain this?
Which MFC / manifest files should be packaged with a win32ui 
application binary. (py2exe doesn't collect that right directly)


Robert


PS: in C:\python26  is a update_manifest.py which adds a 
"Microsoft.Windows.Common-Controls" section to a local 
python.exe.manifest.  Don't know if this is from 2.6.6 or from 
earlier python 2.6 versions, because the file is rather old.

          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"

well, what actually does this do?  the presence of this manifest 
file/section makes a win32ui app look strange (background of 
labels etc.), and fatal: auto-magical button pressing is going on 
everywhere as soon as you move the mouse over a button or even 
without!  what is this?
(I've seen with a debug print:  the HookCommand'ed handlers in 
those win32ui apps are called with strange big command 
notification codes - while true commands upon e.g. button pressing 
have a notification code of 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python.exe.manifest
Type: text/xml
Size: 958 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-win32/attachments/20111107/9cc5fe67/attachment-0002.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32ui.pyd.manifest
Type: text/xml
Size: 746 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-win32/attachments/20111107/9cc5fe67/attachment-0003.xml>


More information about the python-win32 mailing list