New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snoop doesn't load source code from compiled functions #28
Comments
The source code is truly unavailable. It's not stored in the code object and Python doesn't know where to find it because You can create a real file, write |
This sounds like a hack, but works! Thanks a lot for your help! |
You can also accomplish your main goal more elegantly with import random
import math
source = """
def main():
print(random)
print(math)
"""
code = compile(
source=source,
filename="<filename>",
mode='exec',
)
globs = {"random": random}
exec(code, globs)
globs["main"]() This prints the |
I'm trying to debug functions, generated from the source in runtime, but for some reason, snoop is unable to show the source code of such function. At the same time it shows variables and nested functions source - see an example below. Please, suggest, if I'm doing something wrong? Thanks!
Script output
Script code
The text was updated successfully, but these errors were encountered: