warning when doubly liked list is defined globally

Fredrik Lundh fredrik at pythonware.com
Mon Sep 5 12:03:59 CEST 2005


"chand" <chandra.bangalore at gmail.com> wrote:

> 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
>
> Please let me know how to remove this error

you left out the line number from that error message, and the code you
posted doesn't even compile:

  File "chand.py", line 67
    elif    arg[0]  ==   "ADD_OPTIONAL_PARAM" :
                                              ^
IndentationError: unindent does not match any outer indentation level

(from what I can tell, you never assign to g_opt_list in that script, so it
sure looks like you didn't post the right version of your program.  but
instead of reposting the code, look at the line Python told you to look
at; if you cannot figure out how to fix that, try to reduce the script to
a few lines before posting the code)

</F> 






More information about the Python-list mailing list