[IronPython] Pywin32 porting woes...
cenovsky at bakalari.cz
Wed May 12 12:29:48 PDT 2010
Trying to work with CPython win32api is not a good idea. You should use
win32 api directly via clrtype.py and pinvokes. Download (Sample)
from http://ironpython.codeplex.com/releases/view/36280 and check how
for example MessageBox function is imported from user32.dll. The same
way use for all functions you need from win32 api (replace pywin32
module with your proxy module).
Will Sadkin wrote:
> Hi list,
> I am not sure who to go to with this...
> We have a large legacy CPython library set that makes extensive use of
> the pywin32 extensions Mark Hammond wrote. I would like to use
> IronPython to build a RESTful service around the use of this code, but
> have discovered that this will be problematic at best, and impossible at
> I saw through some net searching that William Reade managed to get some
> portions of win32api to work last year using ironclad
> So I thought I'd try to see how far I could get with some of the win32
> stuff... I managed to get win32api to import with a zillion warnings,
> but when I tried to import pythoncom, I got errors nesting down to a
> problem with the import of pywintypes.
> Looking into the code, it assumes that sys.platform startswith("win32")
> must be True if it's windows; this isn't the case with ipy; instead it's
> Ok, easy to modify, to get to the next issue in the onion, which I'm
> stumped on...
> 'import pythoncom' fails. I've worked through the code enough to track
> down the source of this to problems importing from the pywintypes dll.
> It turns out that in cpython:
> C:\> c:\Python26\python.exe
> Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
> (Intel)] on
>>>> import imp
> <module 'pywintypes' from 'C:\Windows\system32\pywintypes26.dll'>
> That is, imp.load_dynamic() returns a module object for this.
> In ipy :
> C:\> C:\Program Files (x86)\IronPython 2.6\ipy.exe
> IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4062
>>>> import sys
>>>> import ironclad
>>>> import imp
> That is, in ipy, the imp.load_dynamic() *doesn't* return a module, and
> raises no exception or anything that would indicate why this was the
> Which leads to the following questions:
> 1) Can anyone tell me why this is?
> 2) Is this an ironclad issue, an ipy bug, an incompatible change in
> imp's behavior in ipy, or something else?
> 3) Is this a path worth pursuing?
> 4) If not, can anyone give me any recommendations for what to use
> instead of ipy?
> 5) Also, as an aside, will ironpython ever support .pth files to augment
> the module search path?
> /Will Sadkin
> Users mailing list
> Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users