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

[feature] Fall back to pretty print in REPL #183

Open
MadameMinty opened this issue May 13, 2024 · 1 comment
Open

[feature] Fall back to pretty print in REPL #183

MadameMinty opened this issue May 13, 2024 · 1 comment

Comments

@MadameMinty
Copy link

In Python < 3.13 REPL:

>>> ic()
ic| Error: Failed to access the underlying source code for analysis. Was ic() invoked in a REPL (e.g. from the command line), a frozen application (e.g. packaged with PyInstaller), or did the underlying source code change during execution?

Suggestion: upon this error, fall back to pretty printing args & kwargs or current time if none, so that e.g. copy-pasting code fragments including icecream calls still yields some benefits, and it could be used to override builtin from icecream import ic as print in a pinch. Possibly update documentation to note this behavior since the error won't be informative.

@gruns
Copy link
Owner

gruns commented Dec 17, 2024

@MadameMinty that's a great idea! 🎉

  1. it would still be useful to print a warning to let users know that icecream can't access the underlying source code and thus fell back to pretty print
  2. i dont have time to implement this right now. do you have time to implement this and submit it in a little PR? 🙌

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