How do I avoid this global SyntaxWarning?

gradha at iname.com gradha at iname.com
Sat Aug 25 17:35:20 CEST 2001


Hi.

Promptly most of my scripts give SyntaxWarnings under Python 2.1.1, and the
warning is so strange to me, and doesn't explain anything or point in any
direction that I don't know exactly what to do. I've searched the
documentation for warning, syntax and global keywords, but I don't seem to
find what is making python angry. Here's the example:

#!/usr/bin/env python

expresion_include = "a string"

if __name__ == "__main__":
   global expresion_include
   print expresion_include

As said before, versions of Python 2.0 and earlier didn't show this warning.
What is it and how do I make it go away?

-- 
 Grzegorz Adam Hankiewicz   gradha at terra.es   http://gradha.infierno.org



More information about the Python-list mailing list