[Idle-dev] Python Core Dump

Fuzzyman fuzzyman at voidspace.org.uk
Tue Nov 22 10:11:00 CET 2005


Kurt B. Kaiser wrote:

> [snip...]
>
>>>      
>>>
>>Mine neither - ``operator.pyd``
>>    
>>
>
>There's a builtin module 'operator' in standard CPython, but no operator.pyd.
>It must have come with one of your non-standard implementations.
>
>  
>

My mistake - I don't know where I got that idea from. I have no
``operator.pyd``.

>Try this:
>Windows 2K, Python 2.4.1:
>
>  
>
>>>>imp.find_module('operator')
>>>>        
>>>>
>(None, 'operator', ('', '', 6))
>
>[Module is '6':  C_BUILTIN]
>
>What do you get?
>  
>
Windows XP SP2 - Activestate 2.4.2

IDLE 1.1.2     
>>> import imp
>>> imp.find_module('operator')
(None, 'operator', ('', '', 6))
>>> import operator
>>> operator.__file__

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in -toplevel-
    operator.__file__
AttributeError: 'module' object has no attribute '__file__'
>>>

[snip..]

>So far, I suspect the problem is in your setup, i.e.  the non-standard
>Python module operator.pyd, rather than IDLE.
>
>The operator module should not be type '1'.
>
>But if you do get '3' or '6' for the module type, as I did, then try
>instrumenting EditorWindow._find_module() and
>EditorWindow.open_module() with print statements to locate your
>'crash'. It may be that imp.load_module() is failing, try running it
>manually.
>
>I think it's fair to say that while it's ok to have several versions
>of python on your machine, they should be in separate directory trees.
>So if you are running CPython from python.org, there shouldn't be any
>operator.pyd from ActiveState or wherever in your CPython tree.
>
>  
>
The machine I tested it on *only* has Activestate Python 2.4.2
installed. The machine with Movable Python is different.

I tried the test you suggest above, with interesting results.

I edited ``EditorWindow._find_module`` with 7 print statements. Edited
code shown below  :

def _find_module(fullname, path=None):
    """Version of imp.find_module() that handles hierarchical module
names"""
    print 'fullname', fullname
    file = None
    for tgt in fullname.split('.'):
        if file is not None:
            file.close()            # close intermediate files
        print 'tgt', tgt
        (file, filename, descr) = imp.find_module(tgt, path)
        print 'filename', filename
        print 'descr', descr
        if descr[2] == imp.PY_SOURCE:
            break                   # find but not load the source file
        module = imp.load_module(tgt, file, filename, descr)
        print 'Got here', module
        try:
            path = module.__path__
        except AttributeError:
            print 'Got here too.'
            raise ImportError, 'No source for module ' + module.__name__
    print 'Got here three ??'
    return file, filename, descr

I then ran IDLE from the command line, and did "open module ->
operator". You can see the results of the print statements below. The
crash happens after the ImportError is raised... hmm.. maybe I should
have tried patching ``EditorWindow.open_module`` as well, I didn't see
that suggestion until now.

Anyway - *after* the crash a traceback from Tkinter is printed to the
console. This is part of an rpc call. Whether it will make any sense to
you is another matter. :-)

C:\Program Files\Windows Resource Kits\Tools>python
C:\Python24\Lib\idlelib\idle.pyw
fullname operator
tgt operator
filename operator
descr ('', '', 6)
Got here <module 'operator' (built-in)>
Got here too.
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__
    return self.func(*args)
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 456, in callit
    func(*args)
  File "C:\Python24\lib\idlelib\PyShell.py", line 493, in poll_subprocess
    response = clt.pollresponse(self.active_seq, wait=0.05)
  File "C:\Python24\lib\idlelib\rpc.py", line 421, in pollresponse
    message = self.pollmessage(wait)
  File "C:\Python24\lib\idlelib\rpc.py", line 373, in pollmessage
    packet = self.pollpacket(wait)
  File "C:\Python24\lib\idlelib\rpc.py", line 344, in pollpacket
    r, w, x = select.select([self.sock.fileno()], [], [], wait)
error: (10093, 'Either the application has not called WSAStartup, or
WSAStartup
failed')

C:\Program Files\Windows Resource Kits\Tools>

Let me know if you want me to file a bug report - or whatever.

All the best,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

>If you are running ActiveState Python, I'm not going to be much help,
>I'm afraid.  But if you can narrow it down to something in IDLE, I'll
>try to fix it.
>
>  
>



More information about the IDLE-dev mailing list