Created
July 18, 2009 11:19
-
-
Save andreyvit/149509 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import module | |
def handle(): | |
... | |
def main(): | |
try: | |
module.test() | |
except: | |
handle() | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test(): | |
import third |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== /Users/andreyvit/Projects/hellow/python/third.py(2) None::<module> | |
frame.f_locals.keys() == ['__builtins__', '__doc__', '__file__', '__name__'] | |
frame.f_globals.keys() == ['__builtins__', '__doc__', '__file__', '__name__'] | |
frame.f_globals['__name__'] == None | |
frame.f_globals['__file__'] == None | |
['co_argcount', 'co_cellvars', 'co_code', 'co_consts', 'co_filename', 'co_firstlineno', 'co_flags', 'co_freevars', 'co_lnotab', 'co_name', 'co_names', 'co_nlocals', 'co_stacksize', 'co_varnames'] | |
=== /Users/andreyvit/Projects/hellow/python/module.py(3) None::test | |
frame.f_locals.keys() == [] | |
frame.f_globals.keys() == ['__builtins__', '__doc__', '__file__', '__name__', 'test'] | |
frame.f_globals['__name__'] == module | |
frame.f_globals['__file__'] == /Users/andreyvit/Projects/hellow/python/module.pyc | |
['co_argcount', 'co_cellvars', 'co_code', 'co_consts', 'co_filename', 'co_firstlineno', 'co_flags', 'co_freevars', 'co_lnotab', 'co_name', 'co_names', 'co_nlocals', 'co_stacksize', 'co_varnames'] | |
=== /Users/andreyvit/Projects/hellow/python/main.py(69) None::main | |
frame.f_locals.keys() == [] | |
frame.f_globals.keys() == ['__builtins__', '__doc__', '__file__', '__name__', 'encode_exception_name', 'extract_tb', 'get_class_name', 'get_traceback', 'handle', 'main', 'module', 'os', 'sys'] | |
frame.f_globals['__name__'] == __main__ | |
frame.f_globals['__file__'] == /Users/andreyvit/Projects/hellow/python/main.py | |
['co_argcount', 'co_cellvars', 'co_code', 'co_consts', 'co_filename', 'co_firstlineno', 'co_flags', 'co_freevars', 'co_lnotab', 'co_name', 'co_names', 'co_nlocals', 'co_stacksize', 'co_varnames'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print 2 / 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment