Win32 com object freezing excel

PoulsenL at capecon.com PoulsenL at capecon.com
Thu Jun 21 21:19:43 EDT 2001


I have a _really_ simple com server that simply passes objects called from
Excel to Numpy and back.  I have an inverse method to get around Excel's
size limitations.  This works like a charm.  

Then I have an eigenvalues method that freezes at times on my win95 boxes
and _always_ freezes excel on nt and 2K systems.  I have tried using lists
and tuples but can't seem to get it to work.  Any help would be greatly
appreciated.

Loren

Here is the code snippet of the functions:

class PythonNumeric:
    _public_methods_ = [ 'InvertMatrix', 'Eigenvalues' ]
    _reg_progid_ = "PythonNumeric.Utilities"
    # NEVER copy the following ID 
    # Use "print pythoncom.CreateGuid()" to make a new one.
    _reg_clsid_ = "{3B262C80-01BA-11D5-A9ED-0010A4C3B041}"

    def InvertMatrix(self, MatrixIn):
        import Numeric
        import LinearAlgebra
        MatrixIn = MakePythonObject(MatrixIn)
        return ((LinearAlgebra.inverse(Numeric.array(MatrixIn))),)


    def Eigenvalues(self, MatrixIn):
        import Numeric
        import LinearAlgebra
        MatrixIn = MakePythonObject(MatrixIn)        
        return (((LinearAlgebra.eigenvalues(Numeric.array(MatrixIn))),),)

# Add code so that when this script is run by
# Python.exe, it self-registers.
if __name__=='__main__':
    print "Registering COM server..."
    import win32com.server.register
    win32com.server.register.UseCommandLine(PythonNumeric)




More information about the Python-list mailing list