sample and solution posted in another branch of this thread
--
http://mail.python.org/mailman/listinfo/python-list
yes I have imported math in the file I want to use it. But the imported
module "math" is not visible in function without a global instruction.
But the solutions already proposed seems to work file for my sample
program. I will try on my project soon :)
--
http://mail.python.org/mailman/listinfo/
lot's of solutions proposed in the discussion works fine :
file run.py :
def run_ut( test ) :
# to have the problem the execfile MUST be in a function
# execfile( test ) # ERROR
execfile( test, globals() ) # OK
exec "import ut_00" # OK
exec file(test).read() #
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 :
You're right, the problem is around the usage of "execfile".
But I have still difficulties to get a simple sample and have no
enough time to work on it until end of week.
I will post if I resolve my problem or if I can get a simple sample.
--
http://mail.python.org/mailman/listinfo/python-
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_
I have a stange side effect in my project :
in my project I need to write "gobal" to use global symbol :
...
import math
...
def f() :
global math # necessary ?? else next line generate an error
message ?
print math.pi
(the problem is for all global module symbol)
I have certainl