Skip to content

arg_name=True not usable in Jupyter & IPython #103

Description

@auderson
from objprint import op

def func():
    return 1

cc = op(func(), arg_name=True)

image

maybe it's because here:

module = inspect.getmodule(frame)
if module is None:
return None
source = inspect.getsource(module)

module is None for Jupyter & IPython, but they have file:
jupyter:
image

ipython:
image

and source can be retrieved with:
image

Change to source = inspect.getsource(frame) will work:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions