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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gen_tricomi

    #1

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

    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[color=blue][color=green][color=darkred]
    >>> import sys
    >>> sys.modules.key s()[/color][/color][/color]
    ['tkFileDialog', 'random', 'struct', 'tempfile', 'idlelib.cPickl e',
    'imp', 'collections', 'zipimport', 'string', 'SocketServer', 'repr',
    'idlelib.string ', 'idlelib.bdb', 'itertools', 'idlelib.Socket Server',
    'ConfigParser', 'signal', 'idlelib.IOBind ing', 'threading',
    'tkMessageBox', 'idlelib.warnin gs', 'idlelib.struct ',
    'idlelib.cStrin gIO', 'cStringIO', 'locale', 'idlelib.thread ing',
    'idlelib.TreeWi dget', 'idlelib.rpc', 'atexit', 'idlelib.re',
    'encodings', 'idlelib.Remote Debugger', 'idlelib.tempfi le',
    'idlelib.codecs ', '_tkinter', 'bdb', 're',
    'idlelib.Remote ObjectBrowser', 'ntpath', 'idlelib.imp',
    'idlelib.locale ', 'idlelib.thread ', 'math', 'idlelib.Debugg er',
    'Tkinter', 'idlelib.traceb ack', 'idlelib.marsha l', 'UserDict', 'Queue',
    'idlelib.StackV iewer', 'codecs', 'idlelib.copy_r eg', '_locale',
    'socket', 'thread', 'sre', 'idlelib.time', 'traceback',
    'idlelib.socket ', 'idlelib.CallTi pWindow', 'os', 'marshal',
    'idlelib.tkFile Dialog', '_sre', '__builtin__', 'select', 'idlelib.os',
    'idlelib.ZoomHe ight', 'idlelib.Config Parser', 'errno', '_socket',
    'binascii', 'sre_constants' , 'types', 'idlelib.__buil tin__',
    'idlelib.tkMess ageBox', 'cPickle', '_codecs', 'encodings.cp12 52',
    'idlelib.repr', 'idlelib.Queue' , 'idlelib.__main __', 'idlelib.sys',
    'encodings.alia ses', 'exceptions', 'sre_parse', 'FixTk', 'copy_reg',
    'sre_compile', '_random', 'site', 'SimpleDialog', '__main__',
    'idlelib.types' , 'tkCommonDialog ', 'strop', 'encodings.code cs',
    'encodings.exce ptions', 'nt', 'idlelib.lineca che', 'stat', '_ssl',
    'warnings', 'encodings.type s', 'sys', 'idlelib.Tkinte r',
    'idlelib.CallTi ps', 'idlelib.config Handler', 'idlelib.Window List',
    'idlelib.Simple Dialog', 'os.path', 'idlelib.Scroll edList',
    'idlelib.Object Browser', 'idlelib', 'Tkconstants', 'linecache', 'time',
    'idlelib.select ', 'idlelib.run'][color=blue][color=green][color=darkred]
    >>> reload(sys)
    >>> sys.modules.key s()
    >>> 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.lowercas e
    >>> string.lowercas e()
    >>> print 'let me see if an exception can be thrown'
    >>> import nigeria
    >>> import lagos
    >>> no exception[/color][/color][/color]
    SyntaxError: invalid syntax[color=blue][color=green][color=darkred]
    >>> print 'still checks for syntax'
    >>> print 'it checks syntax after the second token has been entered'
    >>> abracadabra
    >>> not[/color][/color][/color]
    SyntaxError: invalid syntax[color=blue][color=green][color=darkred]
    >>> print
    >>> is[/color][/color][/color]
    SyntaxError: invalid syntax[color=blue][color=green][color=darkred]
    >>> print 'syntax check is still working for reserved words'
    >>> you
    >>> can
    >>> check
    >>> the
    >>> rest[/color][/color][/color]
    f[color=blue][color=green][color=darkred]
    >>> for[/color][/color][/color]
    SyntaxError: invalid syntax[color=blue][color=green][color=darkred]
    >>> your
    >>> self
    >>> print 'i think this IDLE session is self explanatory'[/color][/color][/color]


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

    ogahejini@yahoo .com

  • nick

    #2
    Re: problem with reload(sys) (doing reload on the sys module)

    Looks like a bug (probably in IDLE): when I start IDLE from the command
    line, it pops up its interaction window and here is what it says about
    stdout:

    IDLE 1.1.2[color=blue][color=green][color=darkred]
    >>> import sys
    >>> sys.stdout[/color][/color][/color]
    <idlelib.rpc.RP CProxy instance at 0xb76a490c>

    Then I try the reload and I get no output in the interaction
    window:
    [color=blue][color=green][color=darkred]
    >>> reload(sys)
    >>> sys.stdout
    >>>[/color][/color][/color]

    After the reload, stdout has been changed to the terminal from which
    IDLE got started, so I see the messages there:

    <module 'sys' (built-in)>
    <open file '<stdout>', mode 'w' at 0xb7b67068>

    As you can see, stdout has been redefined (back to the way it would be if
    you started Python from the command line, with no IDLE involved).
    --
    nick (nicholas dot dokos at hp dot com)

    Comment

    • gen_tricomi

      #3
      Re: problem with reload(sys) (doing reload on the sys module)

      hi nick,

      have you found any solutions to this problem.
      maybe sys module does not need to be reloaded.
      may Tim peters and the rest can help us on this

      Comment

      Working...