TenjintShell.safe_execfile

TenjintShell.safe_execfile(fname, *where, exit_ignore=False, raise_exceptions=False, shell_futures=False)

A safe version of the builtin execfile().

This version will never throw an exception, but instead print helpful error messages to the screen. This only works on pure Python files with the .py extension.

Parameters
  • fname (string) – The name of the file to be executed.

  • where (tuple) – One or two namespaces, passed to execfile() as (globals,locals). If only one is given, it is passed as both.

  • exit_ignore (bool (False)) – If True, then silence SystemExit for non-zero status (it is always silenced for zero status, as it is so common).

  • raise_exceptions (bool (False)) – If True raise exceptions everywhere. Meant for testing.

  • shell_futures (bool (False)) – If True, the code will share future statements with the interactive shell. It will both be affected by previous __future__ imports, and any __future__ imports in the code will affect the shell. If False, __future__ imports are not shared in either direction.