On this page
  1. inspect.getabsfile
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

inspect.getabsfile

Prev: inspect.get_annotations | Up: inspect | Next: inspect.getargs
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getabsfile
Tags: #public #python3 #stdlib #inspect


Import

import inspect
from inspect import getabsfile

Signature & Overview

inspect.getabsfile(object, _filename=None)

Return an absolute path to the source or compiled file for an object.

Usage

import inspect
import json
from pathlib import Path

path = inspect.getabsfile(json)
assert Path(path).is_absolute()

Gotchas

REPL Inspect

from inspect import getabsfile
help(getabsfile)

Linked from

Related notes