Skip to content

Instantly share code, notes, and snippets.

@georgexsh
georgexsh / goto.py
Created September 18, 2017 07:47
python goto with system trace function
import sys
def j(lineno):
frame = sys._getframe().f_back
called_from = frame
def hook(frame, event, arg):
if event == 'line' and frame == called_from:
try:
frame.f_lineno = lineno
@uniphil
uniphil / gist:7777590
Created December 3, 2013 21:13
send_from_directory

Say you have a package with this layout:

my_project/
    my_app/
        files/
            im_a_file.txt
        __init__.py
    run_my_app.py