I think I understand my problem, but first the sample code extracted to
my project.

Rq : it's an automatic run of unitary test, the names of unitary test
are parameter of main program "imported" file via the "execfile"
function (an usage of "import" instead may be a solution....) :

file run.py :
----------------

def run_ut( test ) :
    # to have the problem the execfile MUST be in a function
    execfile( test )
run_ut( "ut_00.py" )


file ut_00.py :
--------------------
import math

def f() :
    ## global math # <-- just decomment this line to avoid error
    print "Second access :"
    print "\t",math.pi # ERROR

print "First access :"
print "\t",math.pi # OK
f()

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to