-1

i have taken two python modules i,e. GenericFunctions.py and Login_CSA.py

In GenericFunctions.py i declared global variables and i imported those variables in Login_CSA.py

but while writing any print statements with those variables it is showing error message like

"Undefined variable from import"

code in GenericFunctions.py

global g_TargetEnvironment
global g_TargetRegion
global g_TargetSystem
global g_TCDataSheet
global g_Remarks

code in Login_CSA.py

import GenericFunctions

    def Login_CSA(p_TargetEnvironment, p_TargetSystem, p_TargetRegion, p_TCDataSheet, p_TCOutputFile, p_TargetoptLevel, p_TCaseID, p_TCDescription):

        #Script to clear all the global variables declared
        nullifyglobal=GenericFunctions.fn_NullifyGlobal()
         #Script to close any existing firefox is there or not
        closeexistingfirefox=GenericFunctions.fn_CloseExistingFFBrowser()

        GenericFunctions.g_TargetEnvironment = p_TargetEnvironment
        print "g_TargetEnvironment : ", GenericFunctions.g_TargetEnvironment
        GenericFunctions.g_TargetSystem = p_TargetSystem
        print "g_TargetSystem : " , GenericFunctions.g_TargetSystem
        GenericFunctions.g_TargetRegion = p_TargetRegion
        GenericFunctions.g_TCDataSheet = p_TCDataSheet
        GenericFunctions.g_TCDataSheet = GenericFunctions.g_TCDataSheet+".xlsx"

iam getting error at "print "g_TargetEnvironment : ", GenericFunctions.g_TargetEnvironment" , """GenericFunctions.g_TCDataSheet = GenericFunctions.g_TCDataSheet+".xlsx" """ this statement

can u guys pls help me how to solve this issue

4

1 回答 1

1

改变

global g_TargetEnvironment
global g_TargetRegion
global g_TargetSystem
global g_TCDataSheet
global g_Remarks

至:

g_TargetEnvironment = None
g_TargetRegion = None
g_TargetSystem = None
g_TCDataSheet = None
g_Remarks = None
于 2013-11-06T05:58:00.900 回答