Spotfire : Ironpython Browse Windows isn't working

Hello everyone,

I'm trying to create a Browse Windows with ironpython in Spotfire.

In fact, the user clicks on the button to select its own data (that will be imported). These data are inserted in an existing dataframe called STFAMILY.

It's working perfectly in local but not on the web player.

I obtain the following error message :

Could not perform action 'Import Data'.

Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)

at Microsoft.Scripting.Interpreter.FuncCallInstruction`2.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)

at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)

at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)

at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)

at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)

at Spotfire.Dxp.Application.IronPython27.IronPythonScriptEngine.Execute(ScriptDefinition script, Dictionary`2 scope)

at Spotfire.Dxp.Application.Scripting.ScriptService.Execute(ScriptDefinition script, Dictionary`2 scope, InternalLibraryManager internalLibraryManager, NotificationService notificationService)

at Spotfire.Dxp.Application.Scripting.ScriptManager.<>c__DisplayClass4.<ExecuteScript>b__3()

at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(Executor executor, Boolean visible, Boolean sticky, Guid stickyGuid)

at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(String displayName, Executor executor)

at Spotfire.Dxp.Application.Scripting.ManagedScript.Execute(Dictionary`2 environment)

at Spotfire.Dxp.Application.HtmlTextAreaControls.ActionControl.ModifyCore(Object value)

at Spotfire.Dxp.Application.Visuals.HtmlTextArea.InteractWithControl(String id, Action`1 interaction)

 

My ironptyhon script is the following :

 

# Replace tables from file

#from System.Windows.Forms import OpenFileDialog

import clr

clr.AddReference("System.Windows.Forms")

from System.Windows.Forms import OpenFileDialog

from Spotfire.Dxp.Data import *



#get filename from file chooser

d1 = OpenFileDialog()

d1.InitialDirectory='\\\\RepositoryPath'

d1.ShowDialog()

#setup data source from selected file

myDataManager = Document.Data

ds=myDataManager.CreateFileDataSource(d1.FileName)

#replace myTable

myTable = Document.Data.Tables["STFAMILY"] #or use a DataTable script parameter

myTable.ReplaceData(ds)

 

Any help would be appreciated !

 

(1) Answer

Login