Michael,<br><br>Thank you for your help! It finally works. Now there is lots of other things left but this has really helped a lot.<br><br><br><br><div class="gmail_quote">2008/12/16 Michael Foord <span dir="ltr">&lt;<a href="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Kristian Jaksch wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Michael,<br>
<br>
What do you mean exec the import * inside the context to poulate it? Something like:<br>
<br>
*context[&#39;Mapack&#39;] = exec &quot;from Mapack import *&quot; &nbsp; #Doesn&#39;t work<br>
<br>
*Hmmm... think I&#39;m getting tired.<br>
<br>
</blockquote></div>
exec doesn&#39;t return anything.<br>
<br>
Try:<br>
<br>
*exec &quot;from Mapack import *&quot; in context*<br>
<br>
It looked like from your response to Orestis that you were moving away from using an explicit context - which I think will get you into confusion with local variables created by your user code.<br>
<br>
Michael<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Anyway thanks for help!<br>
<br>
<br>
<br>
2008/12/16 Michael Foord &lt;<a href="mailto:fuzzyman@voidspace.org.uk" target="_blank">fuzzyman@voidspace.org.uk</a> &lt;mailto:<a href="mailto:fuzzyman@voidspace.org.uk" target="_blank">fuzzyman@voidspace.org.uk</a>&gt;&gt;<div>
<div></div><div class="Wj3C7c"><br>
<br>
 &nbsp; &nbsp;Michael Foord wrote:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Kristian Jaksch wrote:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;def inputBox_KeyDown(s, e):<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key = e.Key.value__<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = root.inputBox.Text<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if key == 3: #If &#39;Enter&#39; key is pressed<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root.message.Text = eval(result)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except SyntaxError:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exec result in context<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except Exception, e:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &#39;Unhandled exception&#39;, e<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root.inputBox.Text = &quot;&quot; #Clearing inputBox*<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;But this creates a fixed size matrix and I still get an<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exception if I type for example *m=Matrix(2,2)* in the<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;inputBox&#39;. I want to make this as general as possible.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Can&#39;t I place everything that is imported from &#39;Mapack&#39;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;into the &#39;context&#39; dictionary together with whatever the<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;user types in besides of that?<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;You can. I&#39;ll give you a clue - import * makes it harder. Try<br>
 &nbsp; &nbsp; &nbsp; &nbsp;importing Mapack and then it will be easier to put things from<br>
 &nbsp; &nbsp; &nbsp; &nbsp;the module into the dictionary.<br>
<br>
<br>
 &nbsp; &nbsp;Hmmm - actually you could exec the import * inside the context to<br>
 &nbsp; &nbsp;populate it.<br>
<br></div></div><div class="Ih2E3d">
------------------------------------------------------------------------<br>
<br>
_______________________________________________<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>
 &nbsp;<br>
</div></blockquote><div><div></div><div class="Wj3C7c">
<br>
<br>
-- <br>
<a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a><br>
<a href="http://www.voidspace.org.uk/blog" target="_blank">http://www.voidspace.org.uk/blog</a><br>
<br>
<br>
_______________________________________________<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>
</div></div></blockquote></div><br>