[英]Unable to resolve the error in IronPython script embedded in Spotfire
嗨,我是python和spotfire的新手。 我無法解決以下錯誤。
碼
import System
from System.IO import FileStream, FileMode
from Spotfire.Dxp.Application.Visuals import TablePlot
from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers
import clr
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import SaveFileDialog
SaveFile = SaveFileDialog() #GETS THE FILE PATH FROM THE USER THROUGH A FILEDIALOG
SaveFile.Filter = "xls Format (*.xls)|*.xlsx|*.xls|*.xlsx"
SaveFile.ShowDialog()
saveFilename = SaveFile.FileName
print "saveFilename=", saveFilename
stream = FileStream(saveFilename, FileMode.Create) #Export Table data to the file
vizTable.As[TablePlot]().ExportData(DataWriterTypeIdentifiers.ExcelXlsxDataWriter, stream)
stream.Dispose()
當我運行上面的代碼時,出現以下錯誤。
System.MissingMemberException: 'NoneType' object has no attribute 'ExportData'
上面的代碼用於使用Spotfire工具將數據導出到Excel工作表。 請建議我該怎么辦謝謝
vizTable為空,因為為了讓Spotfire對其進行填充/初始化
您必須將其添加為腳本的參數-在下面的示例中,該參數稱為myVisual-添加后可以在代碼中使用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.