objprint icon indicating copy to clipboard operation
objprint copied to clipboard

`arg_name=True` not usable in Jupyter & IPython

Open auderson opened this issue 8 months ago • 1 comments

from objprint import op

def func():
    return 1

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

image

maybe it's because here: https://github.com/gaogaotiantian/objprint/blob/7920c8601e86e97fe05a807d820121bac00471b7/src/objprint/frame_analyzer.py#L55-L58

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

auderson avatar Jun 07 '24 02:06 auderson