Home > front end >  Zen of Python printing in console without `import this`
Zen of Python printing in console without `import this`

Time:08-14

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).

CodePudding user response:

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.

  • Related