Ah. Okay, first, pywin32 isn't registered on PyPI, so you need a -f link to find the files:
easy_install -f http://sourceforge.net/project/showfiles.php?group_id=78018 pywin32
This is easily fixed by adding a PyPI listing with the above URL registered as the "Download URL".
Cool - done!
easy_install successfully installs the package, but in order to do the registry and copying stuff, the postinstall script has to be run:
$ Scripts/pywin32_postinstall.py -install Traceback (most recent call last): File "Scripts\pywin32_postinstall.py", line 5, in ? pkg_resources.run_script('pywin32==210', 'pywin32_postinstall.py') File "c:\cygwin\home\pje\projects\setuptools-0.6\pkg_resources.py", line 448, in run_script self.require(requires)[0].run_script(script_name, ns) File "c:\cygwin\home\pje\projects\setuptools-0.6\pkg_resources.py", line 1166, in run_script execfile(script_filename, namespace, namespace) File "c:\cygwin\home\pje\chandlerstuff\chandler\release\bin\lib\sit e-packages\pywin32-210-py2.4-win32.egg\EGG-INFO\scripts\pywin3 2_postinstall.py", line 365, in ? install() File "c:\cygwin\home\pje\chandlerstuff\chandler\release\bin\lib\sit e-packages\pywin32-210-py2.4-win32.egg\EGG-INFO\scripts\pywin3 2_postinstall.py", line 155, in install LoadSystemModule(lib_dir, "pywintypes") File "c:\cygwin\home\pje\chandlerstuff\chandler\release\bin\lib\sit e-packages\pywin32-210-py2.4-win32.egg\EGG-INFO\scripts\pywin3 2_postinstall.py", line 94, in LoadSystemModule ('.dll', 'rb', imp.C_EXTENSION)) ImportError: DLL load failed: The specified module could not be found.
The problem here is that lib_dir is calculated using the system configuration, instead of by locating where the package is actually installed. I changed the install() function like this:
import timer lib_dir = os.path.dirname(timer.__file__)
Importing some other pywin32 module than 'timer' would be okay; it just looked like something small and unlikely to depend on anything else. With this change, the install script produced this output::
hrm - normally lib_dir is pointing at site-packages - ie, the parent of 'win32', 'win32com' etc - whereas the code above would give site-packages\win32. That function should be fairly easy to make egg-friendly though.
Is there anything I can do to verify that this did in fact work correctly?
Simplest would be to paste the following 2 lines into a file: set py = CreateObject("Python.Interpreter") WScript.Echo("1+1=" & py.Eval("1+1")) then execute: cscript.exe //E:VBScript filename I suspect it will work though given the output you demonstrated. post_install.py creates a .pth file, which I suspect is redundant, or just plain wrong, when using eggs - it might be work looking for that pywin32.pth file and seeing what is in it.
It appears that all would be needed for pywin32 to be fully easy_install-able would be this change to the postinstall script (which shouldn't affect its functionality for direct installation), and an entry on PyPI. No setup script changed required -- or so it appears. Anyone wishing to use the features enabled by the postinstall script would just need to run it with -install.
Excellent!
One question of course is, what features do you lose if you don't run the postinstall? If I hadn't run it, would I still have been able to use Python to access COM objects exposed by other applications, or would I have been unable to do COM at all?
You probably would have only lost the ability to implement COM objects - consuming them should be fine. You don't get the help file registered where pythonwin can find it and don't get a bogus .pth file <wink>, but that is about it. Cheers, Mark