How do I avoid this global SyntaxWarning?

gradha at gradha at
Sat Aug 25 17:35:20 CEST 2001


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

More information about the Python-list mailing list