Getting the following code opening in the console in 9 separate screens when I try to open Python IDLE. As far as I'm aware, there isn't anything that I have done to the original install. Any ideas? Tried uninstalling and reinstalling but no luck. The code shown when I open the program is...
try:
import idlelib.PyShell
except ImportError:
# IDLE is not installed, but maybe PyShell is on sys.path:
try:
from . import PyShell
except ImportError:
raise
else:
import os
idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
if idledir != os.getcwd():
# We're not in the IDLE directory, help the subprocess find run.py
pypath = os.environ.get('PYTHONPATH', '')
if pypath:
os.environ['PYTHONPATH'] = pypath + ':' + idledir
else:
os.environ['PYTHONPATH'] = idledir
PyShell.main()
else:
idlelib.PyShell.main()
I only have the option to close this window and not to create a new Python file.
I am an Idle maintainer and it is very unclear how you tried to open Idle, what you mean by '9 screens', and what you 're-installed', and on what system and version of Python.
The easiest way to start Idle with installed Python is to use the Start menu icon (on Windows) or the equivalent on other systems. On a command line, use python -m idlelib
, where python
starts some version of installed 3.x. For uninstalled 3.x or 2.x, use idlelib.idle
. From within Python, import idlelib.idle
starts Idle.
If you have python 2.7 or 3.4 properly installed and running, so that python -m test.regrtest
runs and passes (.regrtest
is only needed for 2.x), I would be very surprised if Idle did not run with the methods above.
The code you posted is idlelib/idle.pyw. It is used by idlelib/idle.bat and may have other specialized uses, such as running Idle with a subprocess call. I suspect that it is partially obsolete. In any case, I doubt it will be helpful to you.