Python COM对象,不会保存numpy数组

时间:2015-06-04 08:04:37

标签: python windows numpy dll com

我在python中有一个简单的COM对象设置,但我想实际看到输入进来,我将它们转移到一个数组,我想保存为文本文件,以便我可以读取它。

但COM对象正常执行但完全跳过numpy save命令。

这是我的代码

 class PythonUtilities(object):
_public_methods_=['function']

#
# Use pythoncom.CreateGuid() 2/1/08
#
_reg_clsid_= pythoncom.CreateGuid()
_reg_desc_ = "Utilities for Extending Amibroker AFL"
_reg_progid_ = "example1"
_readonly_attrs_ = ['revision']
_public_attrs_=['NDepVar','ArrayLen','ProbArray',
                'X_Open','X_High','X_Low','X_Close',
                'X_Volume','X_OI','Log']

def function(self,InList):
    # example infinite impulse response filter from Amibroker docs
    #
    InList=list(InList)
    a=[]
    if InList == 0:
        InList = [10,10,10,7,7,7,7]

    a=np.asarray(InList)
    np.savetxt("inlint1.txt" , a, fmt='%.18e', delimiter=', ', newline='\n')

    return InList

if __name__=='__main__':
    print "Registering COM Server "
    import win32com.server.register
    win32com.server.register.UseCommandLine(PythonUtilities)

为什么np.savetxt没有执行??

0 个答案:

没有答案