<p>Aight, thanks a lot for your answer!</p>
<p><blockquote type="cite">On Feb 19, 2010 8:38 AM, &quot;Curt Hagenlocher&quot; &lt;<a href="mailto:curt@hagenlocher.org">curt@hagenlocher.org</a>&gt; wrote:<br><br><div>The short answer is &quot;no, that&#39;s not possible&quot;.</div>

<div> </div>
<div>This is effectively a version of the halting problem (<a href="http://en.wikipedia.org/wiki/Halting_problem" target="_blank">http://en.wikipedia.org/wiki/Halting_problem</a>). For an arbitrary script, you can check its syntax for correctness without executing fairly easily. Other errors are potentially detectable as long as the user refrains from using certain programming constructs. In your example below, you might be able to demonstrate that &quot;undefinedVariable&quot; was uninitialized. But the same test would probably also come to that conclusion in the following code:</div>


<div> </div>
<div><p><font color="#500050">
a = &quot;This is a test&quot;
</font></p>exec &quot;undef&quot; + &quot;inedVariables&quot;[:-1] + &#39; = 10&#39;<p><font color="#500050">
print undefinedVariable
b = &quot;This is another test&quot;</font></p></div>
<div><br>As for rolling back changes, you could run the script into a temporary scope if you knew that you were only setting variables. If it succeeds, then run it into a &quot;real&quot; scope. The problem is that an arbitrary script can have side effects. Consider the following short script:</div>


<div> </div>
<div>import sys</div>
<div>sys.path = []</div>
<div> </div>
<div>To protect against that, you effectively need a full sandbox to run code against.</div>
<div> </div>
<div class="gmail_quote"><p><font color="#500050">
On Thu, Feb 18, 2010 at 7:16 PM, Alex Turpin &lt;<a href="mailto:alex.turpin@gmail.com">alex.turpin@gmail.com</a>&gt; wrote:
</font></p><blockquote style="border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;padding-left:1ex" class="gmail_quote"><p><font color="#500050">&gt;
&gt; Hey all,
&gt;
&gt; I am currently embedding IronPython in a C# app of mine. I need to
&gt; execute extern...</font></p>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br></blockquote></div><br>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></p>