problem with reload(sys) (doing reload on the sys module)

gen_tricomi ogahejini at
Wed May 3 19:12:44 CEST 2006

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
on win32
Type "copyright", "credits" or "license()" for more information.

    Personal firewall software may warn about the connection IDLE
    makes to its subprocess using this computer's internal loopback
    interface.  This connection is not visible on any external
    interface and no data is sent to or received from the Internet.

IDLE 1.1.2
>>> import sys
>>> sys.modules.keys()
['tkFileDialog', 'random', 'struct', 'tempfile', 'idlelib.cPickle',
'imp', 'collections', 'zipimport', 'string', 'SocketServer', 'repr',
'idlelib.string', 'idlelib.bdb', 'itertools', 'idlelib.SocketServer',
'ConfigParser', 'signal', 'idlelib.IOBinding', 'threading',
'tkMessageBox', 'idlelib.warnings', 'idlelib.struct',
'idlelib.cStringIO', 'cStringIO', 'locale', 'idlelib.threading',
'idlelib.TreeWidget', 'idlelib.rpc', 'atexit', '',
'encodings', 'idlelib.RemoteDebugger', 'idlelib.tempfile',
'idlelib.codecs', '_tkinter', 'bdb', 're',
'idlelib.RemoteObjectBrowser', 'ntpath', 'idlelib.imp',
'idlelib.locale', 'idlelib.thread', 'math', 'idlelib.Debugger',
'Tkinter', 'idlelib.traceback', 'idlelib.marshal', 'UserDict', 'Queue',
'idlelib.StackViewer', 'codecs', 'idlelib.copy_reg', '_locale',
'socket', 'thread', 'sre', 'idlelib.time', 'traceback',
'idlelib.socket', 'idlelib.CallTipWindow', 'os', 'marshal',
'idlelib.tkFileDialog', '_sre', '__builtin__', 'select', 'idlelib.os',
'idlelib.ZoomHeight', 'idlelib.ConfigParser', 'errno', '_socket',
'binascii', 'sre_constants', 'types', 'idlelib.__builtin__',
'idlelib.tkMessageBox', 'cPickle', '_codecs', 'encodings.cp1252',
'idlelib.repr', 'idlelib.Queue', 'idlelib.__main__', 'idlelib.sys',
'encodings.aliases', 'exceptions', 'sre_parse', 'FixTk', 'copy_reg',
'sre_compile', '_random', 'site', 'SimpleDialog', '__main__',
'idlelib.types', 'tkCommonDialog', 'strop', 'encodings.codecs',
'encodings.exceptions', 'nt', 'idlelib.linecache', 'stat', '_ssl',
'warnings', 'encodings.types', 'sys', 'idlelib.Tkinter',
'idlelib.CallTips', 'idlelib.configHandler', 'idlelib.WindowList',
'idlelib.SimpleDialog', 'os.path', 'idlelib.ScrolledList',
'idlelib.ObjectBrowser', 'idlelib', 'Tkconstants', 'linecache', 'time',
'', '']
>>> reload(sys)
>>> sys.modules.keys()
>>> dir()
>>> print 'hello world'
>>> print 'hi nerds'
>>> print 'it just stops here nothing works again'
>>> print 'is this a bug or a feature'
>>> print 'can some one help'
>>> 2 + 4
>>> print 'but when i restart'
>>> print 'everything returns'
>>> import string
>>> string.lowercase
>>> string.lowercase()
>>> print 'let me see if an exception can be thrown'
>>> import nigeria
>>> import lagos
>>> no exception
SyntaxError: invalid syntax
>>> print 'still checks for syntax'
>>> print 'it checks syntax after the second token has been entered'
>>> abracadabra
>>> not
SyntaxError: invalid syntax
>>> print
>>> is
SyntaxError: invalid syntax
>>> print 'syntax check is still working for reserved words'
>>> you
>>> can
>>> check
>>> the
>>> rest
>>> for
SyntaxError: invalid syntax
>>> your
>>> self
>>> print 'i think this IDLE session is self explanatory'

This is not part of the above IDLE session
please mail me if you have any idea what this means.

ogahejini at

More information about the Python-list mailing list