473,626 Members | 3,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,strin g,math
g_opt_list =[[],[],[],[],[],[],[]]
SIG_STANDARD_HO ME = "/home/chandras/SIGNALLING_STAN DARD/ANSI_SS7/"
symbols=['(',')','{','}' ,'[',']','.']
reverse_symbols =['<','>','~']
layers=['MTP3','SCCP',' IOS','CDTAPM2', 'CDTAPC2','ISUP ','IS-41D-SQA']

GUI_API_COMMAND _LIST = [
"NEW",
"ADD_OPTIONAL_P ARAM",
]

Message_obj = Message()
def Process_GUI_Com mand(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_o pt_list)):
g_opt_list[i] = []
return layerList

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

param_name = optional_parame ter_name

g_opt_list[int(index)].append(optiona l_parameter_nam e)

def main():

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

if __name__ == '__main__':
main()

Sep 19 '05 #1
2 2156
"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_Co mmand" 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
2593
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 tedious to find the cause of the message by inserting print statements. Is there an easier way, e.g. a traceback in Python when lower level messages occur?
1
3075
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, Culture=neutral' in project 'EduWaveApplication' cannot be copied to the run directory because it would overwrite the reference 'EW_Calender, Version=2.5.2060.18779, Culture=neutral'. Warning: The dependency 'EW_StudentThesis, Version=2.5.2055.22884,
3
3060
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 down. Some of these also seem to be "phantoms" where I think I've corrected the problem but the warning message persists. For example, I made some changes in my code and started getting a warning message that I had a "duplicate component name"...
0
2405
by: Manish | last post by:
PHP INI File Setting ------------------------------------------------------------------------------------------------------------------ error_reporting = E_ALL & ~E_NOTICE No warning message are displayed when script executed from the browser. Only Error, Fatal errors are displayed. But when the same script is executed from the command line 192.168.0.2# php lpmonitor.php Warning messages are displayed.
4
449
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 the URL-link associated to "Go") you will obtain this string: "Version: RM43_V1.10.030" Is it possible to have a string.php page that just display this string? how can I do it?
92
6181
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
2251
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 class and I'm trying to do some matrix arithmetic where the elements of the matrices are Octonions. (My Octonions are essentially 8-component vectors with a multiplication table that I compute at runtime. Like vectors, they are a template class, but...
10
13192
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 already talk about this issue. But I still confused.. This is the simple test code I copied from these messages //////////////////////////////////////////////////////////////////// class Base { virtual void foo(); //*position A* };
9
7944
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. "/usr/include/sys/_mbstate_t.h", line 11: warning #2230-D: nonstandard type for a bit field unsigned char __parse_size:3; ^ "/usr/include/sys/_mbstate_t.h", line 12: warning #2230-D: nonstandard type for a bit...
0
8205
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8713
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8514
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7206
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6126
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4208
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2632
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.