[python-win32] win32com error when importing numpy

Mauro maubriga at gmail.com
Tue Jan 18 10:33:21 CET 2011

I get an error (below) when trying to use a python code including numpy. Is
win32 somehow incompatible with numpy? I would appreciate any information
you can provide regarding this issue.

I only get the error if I import any function from numpy!

Minimal example:

import win32com.server.register
import pythoncom
from numpy import mean

class TimeSeriesManipulation:
    _public_methods_ = [ 'SplitString']
    _reg_progid_ = "PythonUtils.NumpyError"
    _reg_clsid_ = "{08A4D1F8-0185-4692-BE40-4AD081DB90B1}"

    def SplitString(self, val, item=None):
        from string import split
        if item != None: item = str(item)
        return split(str(val), item)

if __name__=='__main__':
    print "Registering COM server..."
    import win32com.server.register

Sub tt()
Set PythonUtils = CreateObject("PythonUtils.NumpyError")
response = PythonUtils.SplitString("Hello from VB")
For Each Item In response
MsgBox Item
End Sub

I get a run-time error ' -21474677259(80004005)':

Unexpected Python Error: Traceback (most recent call last):
File "C:\appl\python26\lib\site-packages\win32com\server\policy.py",
line 136 in CreateInstance
return retObj._CreateInstance_(clsid, reqIID)
File "C:\appl\python26\lib\site-packages\win32com\server\policy.py",
line 194, in _CreateInstance_
mvob = call func(classSpec)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110118/1b6912aa/attachment.html>

More information about the python-win32 mailing list