Skip to content

Instantly share code, notes, and snippets.

@techkuz
Created February 20, 2020 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techkuz/ef4f8218d1e72163131b7fe83878a759 to your computer and use it in GitHub Desktop.
Save techkuz/ef4f8218d1e72163131b7fe83878a759 to your computer and use it in GitHub Desktop.
Python find print/ найти принт
import sys
import traceback
class TracePrints(object):
def __init__(self):
self.stdout = sys.stdout
def write(self, s):
self.stdout.write("Writing %r\n" % s)
traceback.print_stack(file=self.stdout)
sys.stdout = TracePrints()
def a():
print "I am here"
def b():
a()
b()
# look for print in the exception message
# based on https://stackoverflow.com/a/1620686/7127824
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment