[python-win32] Building pywin32 & adsi support

Mark Hammond skippy.hammond at gmail.com
Sat Jan 25 04:43:40 CET 2014


On 21/01/2014 9:23 PM, Tim Golden wrote:
> I'm trying to bring my active_directory module up to scratch with Python
> 3. I'm hitting a couple of effective showstoppers.
>
> First: I can't even build pywin32 for any revision past 337015e6d473,
> which is when the IConverterSession stuff went in. I've tried a couple
> of tweaks, but basically:
>
> """
> com/win32comext/mapi/src/mapi.cpp(645) : fatal error C1083: Cannot open
> include file: 'IConverterSession.h': No such file or directory
> error: command '"c:\Program Files (x86)\Microsoft Visual Studio
> 9.0\VC\BIN\cl.exe"' failed with exit status 2
> """

hrmph - that file was sitting in my source tree, but apparently was 
being ignored by hg due to an overly greedy .hgignore line.  I just 
added it - sorry about that.

> Second: the adsi module won't import even in a released pywin32 218
> install on any version of Python 3.x I have installed. It seems to have
> fallen foul of Python 3's more restricted relative import semantics.
> This is Python 3.3 but the same happens for 3.2 & 3.1 and for several
> different incantations of the import (from win32com etc.)
>
>>>> import win32com.adsi
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File "C:\Python33\lib\site-packages\win32comext\adsi\__init__.py",
> line 25, in <module>
>      from adsi import *
> ImportError: No module named 'adsi'
>>>>
>
>
> A simple fix from 2.7 onwards is to use package-relative imports:
>
> "from .adsi import *"

hrmph - that's exactly what my version of __init__.py has, and as I 
mentioned, I believe it's done by 2to3 (by way of one of the "import 
imports" fixers we tell 2to3 to use).  The build process sucks in that 
if you interrupt a build, you might end up with the "2.x" version of the 
file installed, as it doesn't know to re-run 2to3 at build time.  Maybe 
try nuking your "dist" directory and rebuild from scratch?

Hope this helps...

Mark



More information about the python-win32 mailing list