[Idle-dev] An idea and a bug

Jameson "Chema" Quinn jquinn at cs.oberlin.edu
Tue Aug 7 21:48:37 CEST 2007

On 8/7/07, Tal Einat <taleinat at gmail.com> wrote:
> On 8/7/07, Jameson Chema Quinn <jquinn at cs.oberlin.edu> wrote:
> > I'm hacking at my own version of IDLE to try to implement language
> support
> > in Python. I found a bug.
> >
> > 1. The bug.
> > I'm using IDLE to work on a copy of IDLE in my home directory. I copy
> the
> > idlelib directory to ~/jqidlelib , add "jq" to lines 2 and 22 of idle.py
> ,
> > open it in IDLE, and start hacking on the other files. If a hacked
> version
> > of some other module is not open in IDLE and I press F5 to run idle.py,
> I
> > get the desired behaviour (the modules are loaded from my hacked copies)
> but
> > the error display is wacky. Errors refer to the line numbers of my
> hacked
> > versions, but they give the path and code snippets from the actual IDLE
> > directory.
> If you do a directory-wide search for 'idlelib' you'll find that it is
> mentioned in PyShell.py as well. I haven't tried this myself, so
> please inform us whether or not this works :)

Changing it there has no effect. In the intervening time, I'm getting even
weirder behavior: with my hacked EditorWindow open, I fix the bug in my code
and save it. Then I press F5 in the idle.py window again. I get:

Traceback (most recent call last):
  File "/home/compaq/jqidlelib/idle.py", line 22, in <module>
  File "/usr/lib/python2.5/idlelib/PyShell.py", line 1406, in main
    return # couldn't open shell
  File "/usr/lib/python2.5/idlelib/PyShell.py", line 275, in open_shell
    self.pyshell = PyShell(self)
  File "/usr/lib/python2.5/idlelib/PyShell.py", line 813, in __init__
    OutputWindow.__init__(self, flist, None, None)
  File "idlelib/OutputWindow.py", line 16, in __init__
    EditorWindow.__init__(self, *args)
  File "/home/compaq/jqidlelib/EditorWindow.py", line 56, in __init__
    if EditorWindow.help_url is None:
NameError: global name 'trns' is not defined

The "trns" is from the previous version of EditorWindow which NO LONGER
EXISTS on the disk, which is why the code snippet doesn't mention it. Also,
note that the paths for the call stack show a mix between idlelib and
jqidlelib, depending on which files I have open. This is just FALSE - all
modules are actually being loaded from jqidlelib, as I can easily tell if I
introduce a syntax error and then close the file.

Meanwhile, I can work around by just closing and reopening idle. Annoying,

> 2. My idea
> > [snip]
> Awesome! I'll be glad to answer any questions you might have regarding
> IDLE's internals.
> An early pointer: IDLE doesn't currently allow unicode input, so
> you'll have to rework that bit if you want unicode input support.

I can afford to wait on that, as my first test case is Spanish, and Idle
only has minor complaints about accents. Thanks for the heads up, though -
this will need to be fixed for py3k anyway, what's the status on that?

Good luck, and please keep us posted on developments,
> - Tal

ps. here's my idle version stuff:
Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
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.2.1      ==== No Subprocess ====
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/idle-dev/attachments/20070807/4cad692b/attachment.htm 

More information about the IDLE-dev mailing list