diff --git a/Lib/site.py b/Lib/site.py index 4ba078388a37b8..f1a6d9cf66fdc3 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -523,7 +523,12 @@ def register_readline(): pass def write_history(): - from _pyrepl.__main__ import CAN_USE_PYREPL + try: + # _pyrepl.__main__ is executed as the __main__ module + from __main__ import CAN_USE_PYREPL + except ImportError: + CAN_USE_PYREPL = False + try: if os.getenv("PYTHON_BASIC_REPL") or not CAN_USE_PYREPL: readline.write_history_file(history)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: