On this page
inspect.getframeinfo
Prev: inspect.getfile | Up: inspect | Next: inspect.getfullargspec
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getframeinfo
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import getframeinfo
Signature & Overview
inspect.getframeinfo(frame, context=1)
Get information about a frame or traceback object.
Usage
import inspect
info = inspect.getframeinfo(inspect.currentframe())
assert info.lineno > 0 and isinstance(info.filename, str)
Gotchas
- Accepts either a
frameor atracebackobject.
REPL Inspect
from inspect import getframeinfo
help(getframeinfo)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/getfile Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/getfullargspec Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/inspect/ArgInfo Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Arguments Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Attribute Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BlockFinder Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BoundArguments shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BufferFlags shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClassFoundException shared tags: #inspect, #stdlib