Why I need to declare import as global in function

didier.doussaud at gmail.com didier.doussaud at gmail.com
Tue Nov 29 06:57:51 EST 2005


the error message :

EXCEPTION RAISED::

     Traceback (most recent call last):
       File "../tu.py", line 21, in run_tu
         execfile( filename )
       File "TU_05_010.py", line 8, in ?
         import TU_05_tools
       File "./TU_05_tools.py", line 4, in ?
         f()
       File "./TU_05_tools.py", line 2, in f
         print math.pi
     NameError: global name 'math' is not defined

I have remarq that this problem is raised when I execute code in an
imported module (during importation)

I think I will be able to isolate it and have a simple sample soon ....




More information about the Python-list mailing list