Removing Warning Messages .............

chand chandra.bangalore at gmail.com
Mon Sep 19 16:19:07 CEST 2005


Hi.,

In my api.py file 'g_opt_list' is defined globally
g_opt_list =[[],[],[],[],[],[],[]]

when I run the py file, I am getting the Following Error

SyntaxWarning: name 'g_opt_list' is used prior to global declaration
SyntaxWarning: name 'layers' is used prior to global declaration

Please let me know how to remove these warnings.

I found that commenting 'g_opt_list' initialisation in "NEW" command
removes this warning message. But my requirement is that i want to
reset g_opt_list to empty list, whenever "NEW" command is called.

Here is the code which gives the error...

I have removed most of the unwanted code to reduce the size.

Let me know exact reason for this warning  and how to remove these
warnings..

import os,sys,re,string,math
g_opt_list =[[],[],[],[],[],[],[]]
SIG_STANDARD_HOME = "/home/chandras/SIGNALLING_STANDARD/ANSI_SS7/"
symbols=['(',')','{','}','[',']','.']
reverse_symbols=['<','>','~']
layers=['MTP3','SCCP','IOS','CDTAPM2','CDTAPC2','ISUP','IS-41D-SQA']

GUI_API_COMMAND_LIST = [
                        "NEW",
                        "ADD_OPTIONAL_PARAM",
                        ]

Message_obj = Message()
def Process_GUI_Command(arg):
                global Message_obj
                global filename
                out_file = file('/tmp/te.txt', 'w+')

                if      arg[0]  ==  "NEW" :
                        global g_opt_list
                        for i in range(0,len(g_opt_list)):
                                g_opt_list[i] = []
                        return layerList

                elif    arg[0]  ==   "ADD_OPTIONAL_PARAM" :
                        global g_opt_list
                        global layers
                        global index
                        message_name = ""
                        add_delete_flag = 0

                        param_name = optional_parameter_name

g_opt_list[int(index)].append(optional_parameter_name)

def main():

        print "####### choice ",

if __name__ == '__main__':
    main()




More information about the Python-list mailing list