Hi Sarvi,<br><br>I think your best bet is to set a custom exception handler for NameError. Have a look at the docstring for IPython.core.interactiveshell.InteractiveShell.set_custom_exc()<br><br><a href="http://ipython.org/ipython-doc/dev/api/generated/IPython.core.interactiveshell.html?highlight=set_custom_exc#IPython.core.interactiveshell.InteractiveShell.set_custom_exc">http://ipython.org/ipython-doc/dev/api/generated/IPython.core.interactiveshell.html?highlight=set_custom_exc#IPython.core.interactiveshell.InteractiveShell.set_custom_exc</a><br>
<br>Best wishes,<br>Thomas<br>
<div class="gmail_extra"><br><br><div class="gmail_quote">On 29 November 2012 17:51, Saravanan Shanmugham <span dir="ltr"><<a href="mailto:sarvilive@gmail.com" target="_blank">sarvilive@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div>I am using an embedded ipython shell environnment for a Test Development and Execution platform that I am developing.</div>
<div><br></div><div>This includes a set of custom magic commands implemented.</div><div><br>
</div><div>automagic is on.</div><div><br></div><div>I would like to change or see a more cleaner error message when I try a non-existent magic command without a %</div><div><br></div><div>Today I get the following</div>
<div>
<div>sarvi@cnh-nehalem-103|5> asasdasd</div><div>---------------------------------------------------------------------------</div><div>NameError Traceback (most recent call last)</div><div>
/ws/sarvi-sjc/cisco-vm-tools/scripts/tvt in <module>()</div><div>----> 1 asasdasd</div><div><br></div><div>NameError: name 'asasdasd' is not defined</div><div><br></div><div>sarvi@cnh-nehalem-103|6> </div>
<div><br></div><div>I want this custom ipython shell to generate a more clean error message without the traceback just like if I had done the following</div><div><br></div><div><div>sarvi@cnh-nehalem-103|6> %asasdasd</div>
<div>ERROR: Magic function `asasdasd` not found.</div><div>sarvi@cnh-nehalem-103|7> </div></div><div><br></div><div>This mode/capability may not be perfect for python debugging but would be great as general purpose shell. When I would like to switch between the existing and the new mode though a magic command toggle when needed.</div>
<div><br></div><div>How can I achieve that?</div><div> </div></div><div>Thanks,</div><div>Sarvi</div>
<br>_______________________________________________<br>
IPython-User mailing list<br>
<a href="mailto:IPython-User@scipy.org">IPython-User@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
<br></blockquote></div><br></div>