IronPythonを初めて使用し、以下のコードを使用してSpotfireからクロステーブルをエクスポートしてExcelにエクスポートしようとしています。IronPython Script Help - SPotfireでクロステーブルをExcelにエクスポート
vizTableの定義を含むようにこのスクリプトを変更するにはどうすればよいですか?
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[exportWellHeader]().ExportData(DataWriterTypeIdentifiers.ExcelXlsxDataWriter, stream)
stream.Dispose()
以下のエラーが発生します。私はスクリプトのパラメータを設定しましたが、スクリプトに組み込む場所はわかりません。
エラーメッセージ:
saveFilename= C:\Users\D565046\Desktop\test 3.xlsx
Traceback (most recent call last):
File "Spotfire.Dxp.Application.ScriptSupport", line unknown, in ExecuteForDebugging
File "<string>", line 14, in <module>
NameError: name 'vizTable' is not definedMicrosoft.Scripting.Runtime.UnboundNameException: name 'vizTable' is not defined
at IronPython.Runtime.PythonContext.MissingName(SymbolId name)
at Microsoft.Scripting.Runtime.LanguageContext.LookupName(CodeContext context, SymbolId name)
at $456##456(Closure , Scope , LanguageContext)
at Spotfire.Dxp.Application.ScriptSupport.IronPythonScriptEngine.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)
ありがとうございましたが、私はまだ以下のエラーを私に与えた行を置き換えたときに私はまだ下のエラーを取得しています。助言がありますか? SaveFilename = C:デスクトップ\ \ \ユーザーは、(最後の最新の呼び出し) トレースバックをrf.xlsx: で ファイル ""、ライン14をExecuteForDebuggingで ファイル "Spotfire.Dxp.Application.ScriptSupport"、未知のラインを、 NameError:名前 'vizTable'が定義されていません Microsoft.Scripting.Runtime.UnboundNameException:名前 'vizTable'は –
gingineer
です。こんにちは、スクリプトパラメータとして 'vizTable'を含めましたか?エラーは、vizTableが定義されていないと思われるようです。あなたの投稿を新しいスクリーンショットで更新することは可能でしょうか? – HalcyonicDays