Issue1105950
Created on 2005-01-20 13:08 by imperialfists, last changed 2005-01-24 02:50 by imperialfists. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| c | imperialfists, 2005-01-21 08:45 | c | ||
| Messages (4) | |||
|---|---|---|---|
| msg24006 - (view) | Author: imperialfists (imperialfists) | Date: 2005-01-20 13:08 | |
There is a bug in idle caused by load_source, which
switches the stdout of idle to something else.
Here is what I did:
Python 2.3.4 (#1, Nov 2 2004, 11:18:38)
[GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1,
ssp-3.3.2-2, pie-8.7.6)] on linux2
[...i leave this out...]
IDLE 1.0.3
>>> from sys import stdout
>>> print stdout
<idlelib.rpc.RPCProxy instance at 0x407914ac>
>>> print 'a'
a
>>> from imp import load_source
>>> print 'a'
a
>>> print stdout
<idlelib.rpc.RPCProxy instance at 0x407914ac>
>>> m = load_source('bug.py', 'bug.py', open('bug.py'))
>>> print 'a'
>>> print stdout
>>>
the file 'bug.py' contains the following line:
from types import *
meanwhile i see this on my terminal:
a
<idlelib.rpc.RPCProxy instance at 0x407914ac>
when i type "import bug" or "from bug import *"
everything works fine.
This bug also works (at least for me) if I start idle
from the the "Run Command" dialog under kde, instead of
the terminal.
|
|||
| msg24007 - (view) | Author: imperialfists (imperialfists) | Date: 2005-01-21 08:45 | |
Logged In: YES user_id=1201021 Also i find a file named 'c' in my current working directory. |
|||
| msg24008 - (view) | Author: Kurt B. Kaiser (kbk) * ![]() |
Date: 2005-01-24 00:10 | |
Logged In: YES user_id=149084 These low level imp module functions don't just import, they reload() the module. This destroys the redirection of stdin, stdout, stderr that IDLE has set up to work with Tkinter. Using IDLE without its subprocess, and with verbose output: hydra /home/kbk/PYSRC/Lib/idlelib$ ../../python -v ./PyShell.py -n # installing zipimport hook import zipimport # builtin # installed zipimport hook [...] In the IDLE shell: IDLE 1.2a0 ==== No Subprocess ==== >>> import sys >>> sys.stdout <__main__.PseudoFile object at 0x42feac> >>> reload(sys) >>> sys.stdout >>> And on the console: [...] import sys # previously loaded (sys) <module 'sys' (built-in)> <open file '<stdout>', mode 'w' at 0xfa068> imp.load_source() is incompatible with IDLE. Please use the high level import statements. I didn't find any extra files. |
|||
| msg24009 - (view) | Author: imperialfists (imperialfists) | Date: 2005-01-24 02:50 | |
Logged In: YES user_id=1201021 I did not always find a file named c either, it was more of a random occurance, than something reliably reproducable. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2005-01-20 13:08:39 | imperialfists | create | |
