[python-win32] Pb server COM with PHP

Mark Hammond mhammond at skippinet.com.au
Sat Nov 6 01:26:53 CET 2004


> But, with PHP :
>         $oa = new COM("Word.Application");

Presumably this is creating a Word object, not a Python object?

>
> 'import site' failed; use -v for traceback
> pythoncom error: PythonCOM Server - The
> 'win32com.server.policy' module
> could not be loaded.
> Traceback (most recent call last):
>   File "C:\Python23\lib\site-packages\win32com\__init__.py",
> line 5, in ?
>     import win32api, sys, os
> exceptions.ImportError: No module named win32api

that "'import site' failed" is probably the root of the problem - site.py is
what loads the .pth files and sets up your PythonPath so that win32api etc
can be found.

Try setting "PYTHONVERBOSE=2" in your environment before creating the
object - this is the same as "python -v", and should show you the error
importing site.

Mark



More information about the Python-win32 mailing list