On Thu, Dec 24, 2015 at 4:45 PM, Terry Reedy <tjre...@udel.edu> wrote: > >> This file should not exist. Python 3 stores .pyc files in a >> __pycache__ subdirectory. It won't even run "idlelib\__init__.pyc" if >> "idlelib\__init__.py" exists, so your installation is incomplete and >> damaged. I suggest that you uninstall Python 3.5 and then completely >> remove "C:\Python\Python35" before reinstalling. > > 'python -m xyz', where xyz is a package name (directory on disk), runs > xyx/__main__.py (or the xyz/__pycache__/__main__...34.py compiled version).
Running "-m idlelib" still imports idlelib, which executes __init__.py(c). For example, I modified __init__.py to print a message: C:\>py -3 -m idlelib Here I am. Specifically, runpy._run_module_as_main('idlelib', 1) calls runpy._get_module_details, which recurs to get the details for "idlelib.__main__". but first it executes __import__("idlelib") to "avoid catching initialization errors". It returns the module spec and the code object. Then _run_module_as_main calls runpy._run_code to exec the code in the namespace of __main__. That said, Python 3's import system should ignore a .pyc beside a .py file, because it looks for .pyc files in the __pycache__ subdirectory. It only executes "idlelib\__init__.pyc" if the corresponding .py file is missing. That's why I said Nicky's installation was both incomplete (missing "__init__.py") and damaged (somehow containing a Python 2.7 "__init__.pyc"), so I suggested a completely fresh install. Apparently that didn't help, so I presume for some reason it's not actually installing the _tkinter extension module and its dependencies. -- https://mail.python.org/mailman/listinfo/python-list