Import Error within Python Win32 COM object

Sue Giller sag at hydrosphere.com
Tue Oct 23 16:02:50 EDT 2001


I am trying to create a Win32 COM server object out of a python 
class and use it in a VB application.  

import win32com.server.register
win32com.server.register.UseCommandLine(DataSetMaker)

I can get the python object to properly import and use some Python 
modules, but not others.  It would appear that modules that live in the 
Lib directory get found (such as string, cpickle, urllib), but other that 
are in the Python path but not in Lib (such as Numeric) do not.  I get 
an ImportError:  No module named Numeric...

For example, this function works just fine
def _getURL(self):
        import urllib
        import string
       <code ....>

But, if I add `import Numeric` to it, I get the error.  The module runs 
just fine as a simple python class module - it finds all imports, 
whether run from PythonWin or DOS.

Any ideas?

Is there a discussion about the rules/caveats for importing Python 
classes inside a server object, even tho those classes are not 
exposed to the outside world? 




More information about the Python-list mailing list