From: gmcm at hypernet.com (Gordon McMillan)
Date: Tue, 13 Apr 1999 00:34:47 GMT
Subject: how to use exec
In-Reply-To: <7etm5o$bvm$1@nnrp1.dejanews.com>
References: <7etm5o$bvm$1@nnrp1.dejanews.com>
Message-ID: <1288158605-15845960@hypernet.com>
X-UID: 1545                                                  

Jaeho Lee asks:

> Hi folks, I'm making test tools based on python. I want to test
> script includes python script and test tools execute the command
> dynamically. "exec" is good for this. But if exec runs assign
> statement, it stores the variable in local area. I want to put the
> variable in global area. How can I do this? I saw this in python
> pocket reference.	exec codestring [in globaldict [, localdict]] But
> this syntax does not work. Could somebody let me know how to use
> exec?

Perhaps you are interpreting the "[" and "]" as literals, not as 
indicators that the enclosed is optional?

 exec codestring
 exec codestring in myglobals
 exec codestring in myglobals, mylocals



- Gordon




