473,378 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

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()

Sep 19 '05 #1
2 2145
"chand" <ch***************@gmail.com> wrote:
SyntaxWarning: name 'g_opt_list' is used prior to global declaration
SyntaxWarning: name 'layers' is used prior to global declaration
those messages are preceeded by a line number, which tells you where
to look for the problem. when I run your snippet, I only get one warning,
which points to the "Process_GUI_Command" function.

from a namespace perspective, that function contains the following
operations on g_opt_list:

declare g_opt_list as global
use g_opt_list (in range)
use g_opt_list (in the list assigment)
declare g_opt_list as global

the last declaration follows a use (global is a directive, not an ordinary
statement, so the actual program flow doesn't matter here).
Please let me know how to remove these warnings.


move the global statements to the beginning of the function, and make
sure that you only use it once for each variable.

or get rid of them; from what I can tell, you're only *using* the globals
inside that function. you only need the "global" directive if you need to
modify the outer scope, not if you're only using stuff from it.

</F>

Sep 19 '05 #2
chand a écrit :
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.


By fixing your code
Sep 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jean Brouwers | last post by:
Sporadically, a message like this one shows up in our wxPython application: (main.py:3182): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem Is possible but...
1
by: Raed Sawalha | last post by:
when i build asp.net application i have theses warnings messages ,what they mean? Preparing resources... Updating references... Warning: The dependency 'EW_Calender, Version=2.5.2055.20123,...
3
by: Chuck Cobb | last post by:
I'm doing a CSharp project in VS2005 and I'm getting some strange warning messages. The problem is that the warning messages don't link to anything in my code so they are very difficult to track...
0
by: Manish | last post by:
PHP INI File Setting ------------------------------------------------------------------------------------------------------------------ error_reporting = E_ALL & ~E_NOTICE No warning message are...
4
by: lucavilla | last post by:
If you go to http://europe.nokia.com/A4305060, fill the "Enter your product code:" field with the value "0523183" and press "Go" (the ending page URL varies because there's a variable session-ID in...
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
2
by: Thelma Lubkin | last post by:
I use my own matrix and vector classes. I wrote them before such things were generally available and I've stuck with them ever since. I've just added an Octonion class derived from the vectors...
10
by: asm23 | last post by:
Hi, I'm using Intel C++ compiler 9 to compiler a project. But, there are a lot of warning saying like "virtual function override intended....". I searched old messages in Google groups, someone...
9
by: awagner | last post by:
I am compiling a C application on an HP Unix 11.23 platform using the C99 compiler. I am receiving the following three warning message from the /usr/include/sys/_mbstate_t.h include file. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.