[Python-Dev] Showstopper in import?

Tim Peters tim.one@home.com
Fri, 2 Feb 2001 01:44:58 -0500


Turns out IDLE no longer runs.  Starting at line 88 of
Tools/idle/EditorWindow.py we have this class defn:

class EditorWindow:

    from Percolator import Percolator
    from ColorDelegator import ColorDelegator
    from UndoDelegator import UndoDelegator
    from IOBinding import IOBinding
    import Bindings
    from Tkinter import Toplevel
    from MultiStatusBar import MultiStatusBar

    about_title = about_title
    ...

This leads to what looks like a bug (if we're to believe the error msg,
which doesn't mean what it says):

C:\Pyk>python tools/idle/idle.pyw
Traceback (most recent call last):
  File "tools/idle/idle.pyw", line 2, in ?
    import idle
  File "C:\PYK\Tools\idle\idle.py", line 11, in ?
    import PyShell
  File "C:\PYK\Tools\idle\PyShell.py", line 15, in ?
    from EditorWindow import EditorWindow, fixwordbreaks
  File "C:\PYK\Tools\idle\EditorWindow.py", line 88, in ?
    class EditorWindow:
  File "C:\PYK\Tools\idle\EditorWindow.py", line 90, in EditorWindow
    from Percolator import Percolator
SyntaxError: 'from ... import *' may only occur in a module scope
Hit return to exit...

C:\Pyk>

Sorry for the delay in reporting this!  I've had other problems with the
Windows installer (all fixed now), and IDLE *normally* executes pythonw.exe
on Windows, which tosses error msgs into a bit bucket.  So all I knew was
that IDLE "didn't come up", and took the high-probability guess that it was
due to some other problem I was already tracking down.  Lost that bet.