Zen of Python printing in console without `import this`

Question:

The Zen of Python randomly started printing in my console after running my SCRIPT. I can’t recall exactly what updates I made to cause this change.

I’m running a multi-file Python bot, so it’s a bit more complicated to track every single import, but a quick import this search on the directory with VSCode does not show any occurrences of it.

Is there a way to see where exactly or which line/import is causing the print to debug this?

I’m using Python 3.10.5, Windows on VSCode (though I don’t think this matters as I tried running in IDLE and same thing happens).

Asked By: Lego490

||

Answers:

Assuming that it is indeed caused by an import this, you could temporarily edit the this module (at Python3x/Lib/this.py) and add a breakpoint(), then print the stack trace (where if using pdb) and figure out exactly where it was imported from.

Answered By: duckboycool
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.