Skip to content
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

arg_name=True not usable in Jupyter & IPython #103

Open
auderson opened this issue Jun 7, 2024 · 1 comment
Open

arg_name=True not usable in Jupyter & IPython #103

auderson opened this issue Jun 7, 2024 · 1 comment

Comments

@auderson
Copy link

auderson commented Jun 7, 2024

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

@gaogaotiantian
Copy link
Owner

Hmm, okay. I'll admit that I don't use Jupyter so it's never my first priority. I'll take a look at this and see if can be gracefully fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants