Jump to content

Created a spk out of the Iron Python script, but when I execute it error:'NameError: global name 'Application' is not defined'


Sumeeth Tewar

Recommended Posts

I Loaded the module as follows:

from Spotfire.Dxp.Framework.ApplicationModel import NotificationService

import sys

sys.path.append(ModulesService.GetResourceDirectoryPath("ABC.py"))

from ABC import orchestrate

 

orchestrate();

now the code inside orchestrate is as follows:

def orchestrate():

# Notification service

logFileName='';

try:

notify = Application.GetService[NotificationService]();

notify.AddInformationNotification("Starting Upload ", "SERVER NAME: ", CONST_XYZ);

...

...

do some work...

But I get Error as:

File "C:Program Files (x86)TIBCOSpotfire7.11.0ModulesABC_1.0.0.0ABC.py", line 364, in orchestrate

NameError: global name 'Application' is not defined

 

 

IronPython.Runtime.UnboundNameException: global name 'Application' is not defined

at IronPython.Compiler.PythonGlobal.GetCachedValue(Boolean lightThrow)

at IronPython.Compiler.PythonGlobalInstruction.Run(InterpretedFrame frame)

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

at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)

at IronPython.Compiler.PythonCallTargets.OriginalCallTarget6(PythonFunction function, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)

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

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

at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)

at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)

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

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

I have tried looking up how to Import the Application, but did not find any help.

I expect the notification from this script existing in the module to be visible on spotfire notifications.

Link to comment
Share on other sites

You are using Application.GetService within orchestrator module without defining it. You have defined it in iron python script not the module so script is not able to identify where that Application class is defined.

use thatfrom Spotfire.Dxp.Framework.ApplicationModel import NotificationService in your orchestrator class as well

https://community.spotfire.com/wiki/how-deploy-custom-python-modules-use-tibco-spotfirer

Link to comment
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...