classification
Title: python.exe crashes or hangs on help() modules when bad modules found
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: devplayer, eric.araujo, haypo, r.david.murray, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2010-10-10 02:03 by devplayer, last changed 2013-06-30 05:34 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
python_help_modules_help_dialog.png devplayer, 2010-10-30 02:43 Hidden prompt window.
unnamed devplayer, 2011-01-03 21:13
python_exe_help()_modules_app_modal_popup_window_behind_main_window_a.png devplayer, 2011-04-27 16:31
Messages (19)
msg118298 - (view) Author: Dev Player (devplayer) Date: 2010-10-10 02:03
2010-10-10 python.exe crashes or hangs on help() modules 
when bad modules found

#######################################################################
SUMMARY

The python.exe command line interpreter crashes or hangs when
typing first >>>help() then >modules and a corrupt module is found.

Python 2.7 WinXP SP3 see version details in OUTPUT sections
#######################################################################
EXPLANATION

# -----------------------
I have a workaround as a user. However it appears to be a bug 
from previous Python versions, 2.5 and 2.6 from what I've seen 
through Google and other help() module tickets. 

The workaround is simply remove the corrupt package.

# -----------------------
I've noticed when there is a corrupt package on my PC in the 
Q:\Python27\Lib\site-packages folder that seems to cause 
a problem when issuing >>>help() then >modules in Python. 

Python command line interperter doesn't gracefully exit the 
assertion, it crashes or hangs.

When entering python.exe, idle.exe or pycrust.bat (runs pycrust.py),
typing help(), then typing modules, the help routine runs most of 
the "search-for-packages" routine fine (see OUTPUT SECTION below) 
and seems to find all the installed modules but when it's 
finished it does the following:

- python.exe either crashes, or puts up a help> prompt window and 
  then drops to the DOS command prompt as seen below.

  MS window error:
  python.exe has encountered a problem and needs to clos.
  We are sorry for the inconvienience
  AppName: python.exe
  AppVer: 0.0.0.0
  ModName: unknown
  ModVer: 0.0.0.0
  Offset: 00a20fdf

- IDLE.py doesn't crash but after the >>>help() >modules it shows
  the errors in .py files

- PyCrust.py runs the >>>help() > modules it then shows errors 
  in .py files, it then crashes


In my case you will note the problem occurs on my install of the 
pythonwin package. On my system pythonwin will work until I exit. 

I installed a new version pythonwin just after installing Python 2.7.
The pythonwin version always crashed on exit since it was installed. 
The old pythonwin was deinstalled before installation of the new.

However, having a corrupt installed package shouldn't crash python.

pythonwin version: pywin32 build214

# -----------------------
Something of note:
    All my development, including Python 2.7 installation and 
    packages and projects are on my Q: drive, which is 
    a mapped drive pointing to a sub-folder on a 
    networked-shared folder in WinXP.

    Actual Folder:
        D:\SUBST_DRIVES\DRIVE_Q_DEVELOPMENT
    Net-shared Folder:
       \\Mycomp\D$\Subst_drives
    Mapped Folder:
        Q: = \\Mycomp\D$\Subst_drives\DRIVE_Q_DEVELOPMENT

    Although not directly used by the user (me) I also have 
    subst'd drives attached to sub-folders of:
    D:\SUBST_DRIVES\DRIVE_Q_DEVELOPMENT
    such as:
    U: = D:\SUBST_DRIVES\DRIVE_Q_DEVELOPMENT\Projects\Python27\current

    I only mention this in case the >>>help() >modules routine, 
    while seeking modules, can traverse folder structure attached 
    to soft and hard link combos, symbolic links and junction points 
    or whether they have an effect on traversing the folder structure 
    while searching for packages.

However, I went directly to the folder holding python.exe
at D:\SUBST_DRIVES\DRIVE_Q_DEVELOPMENT\Python27\python.exe
When doing help() modules .\python.exe crashed at the end of 
executing "modules" as well.

# -----------------------
So far, I personally have not come across any other issues 
with my installation and python programs and demo code run 
with Python 2.7 except the previously noted exiting-of-pythonwin

# -----------------------
Further details and output from running help() modules below for each
of python.exe, pycrust and idle.


#######################################################################
OUTPUT 
(3 Sections for 3 programs packaged with Python distribution)
#######################################################################
#######################################################################
#######################################################################
SECTION 1 OF 3 
python.exe
#----------------------------------------------------------------------

Q:\Projects\Python27>python.exe
Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> modules

Please wait a moment while I gather a list of all available modules...

AutoComplete        _threading_local    itertools           sspi
AutoCompleteWindow  _tkinter            json                sspicon
AutoExpand          _warnings           keybindingDialog    stat
BaseHTTPServer      _weakref            keyword             statvfs
Bastion             _weakrefset         lib                 string
Bindings            _win32sysloader     lib2to3             stringold
CGIHTTPServer       _winreg             linecache           stringprep
CallTipWindow       _winxptheme         locale              strop
CallTips            abc                 logging             struct
Canvas              aboutDialog         macosxSupport       subprocess
ClassBrowser        adodbapi            macpath             sunau
CodeContext         afxres              macurl2path         sunaudio
ColorDelegator      aifc                mailbox             symbol
ConfigParser        antigravity         mailcap             symtable
Cookie              anydbm              markupbase          sys
CreateBatchFiles    app                 marshal             sysconfig
CreateMacScripts    argparse            math                tabbedpages
Debugger            array               md5                 tabnanny
Delegator           ast                 media               tarfile
Dialog              asynchat            mhlib               telnetlib
DocXMLRPCServer     asyncore            mimetools           tempfile
EditorWindow        atexit              mimetypes           test
Enums               audiodev            mimify              testcode
FileDialog          audioop             mmap                tests
FileList            base64              mmapfile            text
FixTk               bdb                 mmsystem            textView
FormatParagraph     binascii            modulefinder        textwrap
GrepDialog          binhex              msilib              this
HTMLParser          bisect              msvcrt              thread
HyperParser         bsddb               multifile           threading
ID_NS               bz2                 multiprocessing     time
IOBinding           cPickle             mutex               timeit
IdleHistory         cProfile            netbios             timer
MOCK_WX             cStringIO           netrc               tkColorChooser
MimeWriter          calendar            new                 tkCommonDialog
MultiCall           cgi                 nntplib             tkFileDialog
MultiStatusBar      cgitb               nt                  tkFont
ObjectBrowser       chunk               ntpath              tkMessageBox
ObjectListView      clock               ntsecuritycon       tkSimpleDialog
OutputWindow        cmath               nturl2path          toaiff
ParenMatch          cmd                 numbers             token
PathBrowser         code                odbc                tokenize
Percolator          codecs              opcode              trace
PyParse             codeop              operator            traceback
PyShell             collections         optparse            ttk
PythonOgreConfig    colorsys            os                  tty
Queue               com                 os2emxpath          turtle
RemoteDebugger      commands            parser              types
RemoteObjectBrowser commctrl            pdb                 unicodedata
ReplaceDialog       compileall          perfmon             unittest
ReportVersion       compiler            pickle              urllib
RstripExtension     configDialog        pickletools         urllib2
SampleFramework     configHandler       pipes               urlparse
ScriptBinding       configHelpSourceEdit pkgutil             user
ScrolledList        configSectionNameDialog platform            utils
ScrolledText        contextlib          plistlib            uu
SearchDialog        convert_to_PANP     popen2              uuid
SearchDialogBase    cookielib           poplib              warnings
SearchEngine        copy                posixfile           wave
SimpleDialog        copy_reg            posixpath           weakref
SimpleHTTPServer    core                pprint              webbrowser
SimpleXMLRPCServer  csv                 profile             whichdb
SocketServer        ctypes              pstats              win2kras
StackViewer         curses              pty                 win32api
StringIO            datetime            pub                 win32clipboard
Tix                 dbhash              pubsub              win32com
Tkconstants         dbi                 pubsub1             win32con
Tkdnd               dde                 pubsubconf          win32console
Tkinter             decimal             py_compile          win32cred
ToolTip             difflib             pyclbr              win32crypt
TreeWidget          dircache            pycrust_c           win32cryptcon
UndoDelegator       dis                 pycrust_gdir        win32event
UserDict            distutils           pydoc               win32evtlog
UserList            doctest             pydoc_data          win32evtlogutil
UserString          dprint              pyexpat             win32file
WidgetRedirector    dumbdbm             pyglet              win32gui
WindowList          dummy_thread        pythoncom           win32gui_struct
ZoomHeight          dummy_threading     pythonstartup       win32help
_LWPCookieJar       dynOptionMenuWidget pywin               win32inet
_MozillaCookieJar   email               pywin32_postinstall win32inetcon
__builtin__         encodings           pywin32_testutil    win32job
__future__          errno               pywintypes          win32lz
_abcoll             event               quopri              win32net
_ast                exceptions          random              win32netcon
_autosetuppubsubv1  filecmp             rasutil             win32pdh
_bisect             fileinput           re                  win32pdhquery
_bsddb              fnmatch             regcheck            win32pdhutil
_codecs             font                regutil             win32pipe
_codecs_cn          formatter           repr                win32print
_codecs_hk          fpformat            resource            win32process
_codecs_iso2022     fractions           rexec               win32profile
_codecs_jp          ftplib              rfc822              win32ras
_codecs_kr          functools           rlcompleter         win32rcparser
_codecs_tw          future_builtins     robotparser         win32security
_collections        gc                  rpc                 win32service
_csv                genericpath         run                 win32serviceutil
_ctypes             getopt              runpy               win32timezone
_ctypes_test        getpass             sched               win32trace
_elementtree        gettext             select              win32traceutil
_functools          gl                  servicemanager      win32transaction
_hashlib            glob                sets                win32ts
_heapq              graphics            setup               win32ui
_hotshot            gzip                setuparg1           win32uiole
_io                 hashlib             setupkwargs         win32verstamp
_json               heapq               setupv1             win32wnet
_locale             hmac                setupv2             window
_lsprof             hotshot             sgmllib             winerror
_md5                htmlentitydefs      sha                 winioctlcon
_msi                htmllib             shelve              winnt
_multibytecodec     httplib             shlex               winperf
_multiprocessing    idle                shutil              winsound
_pyio               idlelib             signal              winxpgui
_random             idlever             singletonmixin      winxptheme
_sha                ihooks              site                wsgiref
_sha256             image               smtpd               wx
_sha512             imageop             smtplib             wxPython
_socket             imaplib             sndhdr              wxversion
_sqlite3            imghdr              socket              xdrlib
_sre                imp                 sprite              xml
_ssl                importlib           sqlite3             xmllib
_strptime           imputil             sre                 xmlrpclib
_struct             info                sre_compile         xxsubtype
_subprocess         inspect             sre_constants       zipfile
_symtable           io                  sre_parse           zipimport
_testcapi           isapi               ssl                 zlib

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".


Q:\Projects\Python27>

#----------------------------------------------------------------------
WHAT YOU SEE ABOVE a copy and past:
python.exe either crashes, or puts up a help> prompt window and then 
drops to the DOS command prompt as seen above without indicating
there was a corrupt package.

#######################################################################
#######################################################################
#######################################################################
SECTION 2 OF 3 
IDLE
#----------------------------------------------------------------------

Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

>>> help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> modules

Please wait a moment while I gather a list of all available modules...

AutoComplete        _threading_local    itertools           sspi
AutoCompleteWindow  _tkinter            json                sspicon
AutoExpand          _warnings           keybindingDialog    stat
BaseHTTPServer      _weakref            keyword             statvfs
Bastion             _weakrefset         lib                 string
Bindings            _win32sysloader     lib2to3             stringold
CGIHTTPServer       _winreg             linecache           stringprep
CallTipWindow       _winxptheme         locale              strop
CallTips            abc                 logging             struct
Canvas              aboutDialog         macosxSupport       subprocess
ClassBrowser        adodbapi            macpath             sunau
CodeContext         afxres              macurl2path         sunaudio
ColorDelegator      aifc                mailbox             symbol
ConfigParser        antigravity         mailcap             symtable
Cookie              anydbm              markupbase          sys
CreateBatchFiles    app                 marshal             sysconfig
CreateMacScripts    argparse            math                tabbedpages
Debugger            array               md5                 tabnanny
Delegator           ast                 media               tarfile
Dialog              asynchat            mhlib               telnetlib
DocXMLRPCServer     asyncore            mimetools           tempfile
EditorWindow        atexit              mimetypes           test
Enums               audiodev            mimify              testcode
FileDialog          audioop             mmap                tests
FileList            base64              mmapfile            text
FixTk               bdb                 mmsystem            textView
FormatParagraph     binascii            modulefinder        textwrap
GrepDialog          binhex              msilib              this
HTMLParser          bisect              msvcrt              thread
HyperParser         bsddb               multifile           threading
ID_NS               bz2                 multiprocessing     time
IOBinding           cPickle             mutex               timeit
IdleHistory         cProfile            netbios             timer
MOCK_WX             cStringIO           netrc               tkColorChooser
MimeWriter          calendar            new                 tkCommonDialog
MultiCall           cgi                 nntplib             tkFileDialog
MultiStatusBar      cgitb               nt                  tkFont
ObjectBrowser       chunk               ntpath              tkMessageBox
ObjectListView      clock               ntsecuritycon       tkSimpleDialog
OutputWindow        cmath               nturl2path          toaiff
ParenMatch          cmd                 numbers             token
PathBrowser         code                odbc                tokenize
Percolator          codecs              opcode              trace
PyParse             codeop              operator            traceback
PyShell             collections         optparse            ttk
PythonOgreConfig    colorsys            os                  tty
Queue               com                 os2emxpath          turtle
RemoteDebugger      commands            parser              types
RemoteObjectBrowser commctrl            pdb                 unicodedata
ReplaceDialog       compileall          perfmon             unittest
ReportVersion       compiler            pickle              urllib
RstripExtension     configDialog        pickletools         urllib2
SampleFramework     configHandler       pipes               urlparse
ScriptBinding       configHelpSourceEdit pkgutil             user
ScrolledList        configSectionNameDialog platform            utils
ScrolledText        contextlib          plistlib            uu
SearchDialog        convert_to_PANP     popen2              uuid
SearchDialogBase    cookielib           poplib              warnings
SearchEngine        copy                posixfile           wave
SimpleDialog        copy_reg            posixpath           weakref
SimpleHTTPServer    core                pprint              webbrowser
SimpleXMLRPCServer  csv                 profile             whichdb
SocketServer        ctypes              pstats              win2kras
StackViewer         curses              pty                 win32api
StringIO            datetime            pub                 win32clipboard
Tix                 dbhash              pubsub              win32com
Tkconstants         dbi                 pubsub1             win32con
Tkdnd               dde                 pubsubconf          win32console
Tkinter             decimal             py_compile          win32cred
ToolTip             difflib             pyclbr              win32crypt
TreeWidget          dircache            pycrust_c           win32cryptcon
UndoDelegator       dis                 pycrust_gdir        win32event
UserDict            distutils           pydoc               win32evtlog
UserList            doctest             pydoc_data          win32evtlogutil
UserString          dprint              pyexpat             win32file
WidgetRedirector    dumbdbm             pyglet              win32gui
WindowList          dummy_thread        pythoncom           win32gui_struct
ZoomHeight          dummy_threading     pythonstartup       win32help
_LWPCookieJar       dynOptionMenuWidget pywin               win32inet
_MozillaCookieJar   email               pywin32_postinstall win32inetcon
__builtin__         encodings           pywin32_testutil    win32job
__future__          errno               pywintypes          win32lz
_abcoll             event               quopri              win32net
_ast                exceptions          random              win32netcon
_autosetuppubsubv1  filecmp             rasutil             win32pdh
_bisect             fileinput           re                  win32pdhquery
_bsddb              fnmatch             regcheck            win32pdhutil
_codecs             font                regutil             win32pipe
_codecs_cn          formatter           repr                win32print
_codecs_hk          fpformat            resource            win32process
_codecs_iso2022     fractions           rexec               win32profile
_codecs_jp          ftplib              rfc822              win32ras
_codecs_kr          functools           rlcompleter         win32rcparser
_codecs_tw          future_builtins     robotparser         win32security
_collections        gc                  rpc                 win32service
_csv                genericpath         run                 win32serviceutil
_ctypes             getopt              runpy               win32timezone
_ctypes_test        getpass             sched               win32trace
_elementtree        gettext             select              win32traceutil
_functools          gl                  servicemanager      win32transaction
_hashlib            glob                sets                win32ts
_heapq              graphics            setup               win32ui
_hotshot            gzip                setuparg1           win32uiole
_io                 hashlib             setupkwargs         win32verstamp
_json               heapq               setupv1             win32wnet
_locale             hmac                setupv2             window
_lsprof             hotshot             sgmllib             winerror
_md5                htmlentitydefs      sha                 winioctlcon
_msi                htmllib             shelve              winnt
_multibytecodec     httplib             shlex               winperf
_multiprocessing    idle                shutil              winsound
_pyio               idlelib             signal              winxpgui
_random             idlever             singletonmixin      winxptheme
_sha                ihooks              site                wsgiref
_sha256             image               smtpd               wx
_sha512             imageop             smtplib             wxPython
_socket             imaplib             sndhdr              wxversion
_sqlite3            imghdr              socket              xdrlib
_sre                imp                 sprite              xml
_ssl                importlib           sqlite3             xmllib
_strptime           imputil             sre                 xmlrpclib
_struct             info                sre_compile         xxsubtype
_subprocess         inspect             sre_constants       zipfile
_symtable           io                  sre_parse           zipimport
_testcapi           isapi               ssl                 zlib

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".


Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    help()
  File "Q:\Python27\lib\site.py", line 453, in __call__
    return pydoc.help(*args, **kwds)
  File "Q:\Python27\lib\pydoc.py", line 1723, in __call__
    self.interact()
  File "Q:\Python27\lib\pydoc.py", line 1735, in interact
    request = self.getline('help> ')
  File "Q:\Python27\lib\pydoc.py", line 1746, in getline
    return raw_input(prompt)
  File "Q:\Python27\Lib\site-packages\pythonwin\pywin\framework\app.py", line 367, in Win32RawInput
    ret=dialog.GetSimpleInput(prompt)
  File "Q:\Python27\Lib\site-packages\pythonwin\pywin\mfc\dialog.py", line 223, in GetSimpleInput
    if title is None: title=win32ui.GetMainFrame().GetWindowText()
error: The frame does not exist
>>> 

#----------------------------------------------------------------------
IDLE doesn't crash

#######################################################################
#######################################################################
#######################################################################
SECTION 3 OF 3 
PyCrust
#----------------------------------------------------------------------

PyCrust 0.9.8 - The Flakiest Python Shell
Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Startup script executed: C:\Documents and Settings\User\Application Data\pycrust\startup
help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> modules

Please wait a moment while I gather a list of all available modules...

AutoComplete        _threading_local    itertools           sspi
AutoCompleteWindow  _tkinter            json                sspicon
AutoExpand          _warnings           keybindingDialog    stat
BaseHTTPServer      _weakref            keyword             statvfs
Bastion             _weakrefset         lib                 string
Bindings            _win32sysloader     lib2to3             stringold
CGIHTTPServer       _winreg             linecache           stringprep
CallTipWindow       _winxptheme         locale              strop
CallTips            abc                 logging             struct
Canvas              aboutDialog         macosxSupport       subprocess
ClassBrowser        adodbapi            macpath             sunau
CodeContext         afxres              macurl2path         sunaudio
ColorDelegator      aifc                mailbox             symbol
ConfigParser        antigravity         mailcap             symtable
Cookie              anydbm              markupbase          sys
CreateBatchFiles    app                 marshal             sysconfig
CreateMacScripts    argparse            math                tabbedpages
Debugger            array               md5                 tabnanny
Delegator           ast                 media               tarfile
Dialog              asynchat            mhlib               telnetlib
DocXMLRPCServer     asyncore            mimetools           tempfile
EditorWindow        atexit              mimetypes           test
Enums               audiodev            mimify              testcode
FileDialog          audioop             mmap                tests
FileList            base64              mmapfile            text
FixTk               bdb                 mmsystem            textView
FormatParagraph     binascii            modulefinder        textwrap
GrepDialog          binhex              msilib              this
HTMLParser          bisect              msvcrt              thread
HyperParser         bsddb               multifile           threading
ID_NS               bz2                 multiprocessing     time
IOBinding           cPickle             mutex               timeit
IdleHistory         cProfile            netbios             timer
MOCK_WX             cStringIO           netrc               tkColorChooser
MimeWriter          calendar            new                 tkCommonDialog
MultiCall           cgi                 nntplib             tkFileDialog
MultiStatusBar      cgitb               nt                  tkFont
ObjectBrowser       chunk               ntpath              tkMessageBox
ObjectListView      clock               ntsecuritycon       tkSimpleDialog
OutputWindow        cmath               nturl2path          toaiff
ParenMatch          cmd                 numbers             token
PathBrowser         code                odbc                tokenize
Percolator          codecs              opcode              trace
PyParse             codeop              operator            traceback
PyShell             collections         optparse            ttk
PythonOgreConfig    colorsys            os                  tty
Queue               com                 os2emxpath          turtle
RemoteDebugger      commands            parser              types
RemoteObjectBrowser commctrl            pdb                 unicodedata
ReplaceDialog       compileall          perfmon             unittest
ReportVersion       compiler            pickle              urllib
RstripExtension     configDialog        pickletools         urllib2
SampleFramework     configHandler       pipes               urlparse
ScriptBinding       configHelpSourceEdit pkgutil             user
ScrolledList        configSectionNameDialog platform            utils
ScrolledText        contextlib          plistlib            uu
SearchDialog        convert_to_PANP     popen2              uuid
SearchDialogBase    cookielib           poplib              warnings
SearchEngine        copy                posixfile           wave
SimpleDialog        copy_reg            posixpath           weakref
SimpleHTTPServer    core                pprint              webbrowser
SimpleXMLRPCServer  csv                 profile             whichdb
SocketServer        ctypes              pstats              win2kras
StackViewer         curses              pty                 win32api
StringIO            datetime            pub                 win32clipboard
Tix                 dbhash              pubsub              win32com
Tkconstants         dbi                 pubsub1             win32con
Tkdnd               dde                 pubsubconf          win32console
Tkinter             decimal             py_compile          win32cred
ToolTip             difflib             pyclbr              win32crypt
TreeWidget          dircache            pycrust_c           win32cryptcon
UndoDelegator       dis                 pycrust_gdir        win32event
UserDict            distutils           pydoc               win32evtlog
UserList            doctest             pydoc_data          win32evtlogutil
UserString          dprint              pyexpat             win32file
WidgetRedirector    dumbdbm             pyglet              win32gui
WindowList          dummy_thread        pythoncom           win32gui_struct
ZoomHeight          dummy_threading     pythonstartup       win32help
_LWPCookieJar       dynOptionMenuWidget pywin               win32inet
_MozillaCookieJar   email               pywin32_postinstall win32inetcon
__builtin__         encodings           pywin32_testutil    win32job
__future__          errno               pywintypes          win32lz
_abcoll             event               quopri              win32net
_ast                exceptions          random              win32netcon
_autosetuppubsubv1  filecmp             rasutil             win32pdh
_bisect             fileinput           re                  win32pdhquery
_bsddb              fnmatch             regcheck            win32pdhutil
_codecs             font                regutil             win32pipe
_codecs_cn          formatter           repr                win32print
_codecs_hk          fpformat            resource            win32process
_codecs_iso2022     fractions           rexec               win32profile
_codecs_jp          ftplib              rfc822              win32ras
_codecs_kr          functools           rlcompleter         win32rcparser
_codecs_tw          future_builtins     robotparser         win32security
_collections        gc                  rpc                 win32service
_csv                genericpath         run                 win32serviceutil
_ctypes             getopt              runpy               win32timezone
_ctypes_test        getpass             sched               win32trace
_elementtree        gettext             select              win32traceutil
_functools          gl                  servicemanager      win32transaction
_hashlib            glob                sets                win32ts
_heapq              graphics            setup               win32ui
_hotshot            gzip                setuparg1           win32uiole
_io                 hashlib             setupkwargs         win32verstamp
_json               heapq               setupv1             win32wnet
_locale             hmac                setupv2             window
_lsprof             hotshot             sgmllib             winerror
_md5                htmlentitydefs      sha                 winioctlcon
_msi                htmllib             shelve              winnt
_multibytecodec     httplib             shlex               winperf
_multiprocessing    idle                shutil              winsound
_pyio               idlelib             signal              winxpgui
_random             idlever             singletonmixin      winxptheme
_sha                ihooks              site                wsgiref
_sha256             image               smtpd               wx
_sha512             imageop             smtplib             wxPython
_socket             imaplib             sndhdr              wxversion
_sqlite3            imghdr              socket              xdrlib
_sre                imp                 sprite              xml
_ssl                importlib           sqlite3             xmllib
_strptime           imputil             sre                 xmlrpclib
_struct             info                sre_compile         xxsubtype
_subprocess         inspect             sre_constants       zipfile
_symtable           io                  sre_parse           zipimport
_testcapi           isapi               ssl                 zlib

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "Q:\Python27\lib\site.py", line 453, in __call__
    return pydoc.help(*args, **kwds)
  File "Q:\Python27\lib\pydoc.py", line 1723, in __call__
    self.interact()
  File "Q:\Python27\lib\pydoc.py", line 1735, in interact
    request = self.getline('help> ')
  File "Q:\Python27\lib\pydoc.py", line 1746, in getline
    return raw_input(prompt)
  File "Q:\Python27\Lib\site-packages\pythonwin\pywin\framework\app.py", line 367, in Win32RawInput
    ret=dialog.GetSimpleInput(prompt)
  File "Q:\Python27\Lib\site-packages\pythonwin\pywin\mfc\dialog.py", line 223, in GetSimpleInput
    if title is None: title=win32ui.GetMainFrame().GetWindowText()
error: The frame does not exist

#----------------------------------------------------------------------
Then after doing anything in PyCrust it crashes

#######################################################################
#######################################################################
#######################################################################
msg118301 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-10-10 04:10
There isn't much that Python can do if there is a sufficiently broken C-based module in sys.path.  All you report about the problematic module is that it is 'bad' or 'corrupt'.  Can you give more information about what makes it bad?
msg118362 - (view) Author: Dev Player (devplayer) Date: 2010-10-11 14:23
I believe that a 3rd party package is corrupt. Whether it is or not I don't know. However whether or not a package is corrupt or not is not what I am reporting as a bug.

I am reporting that python.exe crashes when I do help() modules.


In GUI wrappers around python.exe, such as idle and pycrust, I get more information to the problem then when just in python.exe command line interpreter. As per the first post the errors I get in pycrust and idle are:
...
  File "Q:\Python27\Lib\site-packages\pythonwin\pywin\framework\app.py", line 367, in Win32RawInput
    ret=dialog.GetSimpleInput(prompt)
  File "Q:\Python27\Lib\site-packages\pythonwin\pywin\mfc\dialog.py", line 223, in GetSimpleInput
    if title is None: title=win32ui.GetMainFrame().GetWindowText()
error: The frame does not exist

To be honest the meaning of these errors is beyond my expertise, or lack of thereof. I attempted to give as much info on what I experienced with running python.exe help() modules as I saw.

If there is a direction you can point me to that I can gather more information then what I've already given, I'll give that a go as well.

Other pointers to reported problems of a similar nature:
http://mail.python.org/pipermail/pythonmac-sig/2008-November/020712.html
https://bugs.launchpad.net/ubuntu/+source/python2.5/+bug/137210

Again this is not a report of a corrupt package. 

It is a report of python.exe crashing using commands considered part of Python.exe; that being help() then modules.

An external library may be the cause or may not. But if it is an external library that is corrupt I would hope python.exe would not fail because of it, but instead just either ignore the package or report an error. Another reason why I think python.exe shouldn't crash because of external library integrity is what if there is a file or some such thing in one's Python path that looks like and smells like a Python module/package but isn't? Should python.exe fail because of such a file?

I do not know the structure of a Python package or whether pythonwin on my PC is corrupt. However I imaging that if a fake package can be made so that IT is corrupt (perhaps make a missing file) that testing would be relatively easy.

Sorry I don't have more information for you. But hearing from others who have tried their python.exe help() modules works or fails would be a start.
msg118380 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-10-11 17:43
What I am saying is that if an extension module (one that provides non-python code in a load module) is corrupt, then it can totally screw up Python's internal bookkeeping, and there is nothing Python can do to protect itself against that.

If the "corrupt" module in question is pure Python, then you are correct, 'help' should not fail.  If, however, the corrupt module is not pure Python, then there may be nothing that can be done by Python to prevent the failure.

Can you reproduce the problem using a pure Python 'corrupt' module?
msg118397 - (view) Author: Dev Player (devplayer) Date: 2010-10-12 00:47
> On Mon, Oct 11, 2010 at 1:43 PM, R. David Murray <report@bugs.python.org>wrote:
> R. David Murray <rdmurray@bitdance.com> added the comment:
> Can you reproduce the problem using a pure Python 'corrupt' module?
> ----------
>

When in python.exe, and you type help() then modules, aren't you really
asking for packages?
I don't know how to make a package let alone a corrupt one.

If help() modules is in fact looking for just a Python module file with
extension _.py in lib\site-packages I don't know what Python help() modules
looks for in that source code _.py file to be considered a module worth
reporting back to the user. Certain module attributes?

I do not know enough atm about how PythonWin is packaged. I'll look into it
but I'm a newbie here and hopes for well informed facts on PythonWin may be
... well leave it at that.

Perhaps an idea here too: If python.exe help() modules crashes when it
passes control to a module or package that is not pure Python (source code
or byte code) but some kind of C SWIG thing, then perhaps to make python.exe
more robust it should simulate what idle does, as idle does not crash and it
reports error when finished with calling python.exe help() modules.

In other words, perhaps the Python interpreter can call an external routine
(another program) that behaves like help() modules, perhaps using something
like os.system() or subprocess.Popen(). Call it help.py or help.exe or
something. If help.exe returns, all is good. If help crashes just like
Python did at least Python can handle the crashing of help.exe gracefully.
This idea is purely with the interest to make python.exe more robust.
msg118822 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-10-15 19:08
The unnamed quasi-html file loaded with msg118397 was a unless, essentially unreadable duplicate of that message, hence removed.
msg119345 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-21 22:27
There are half a dozen duplicate bugs of this one, with various suggestions on each.  They should be summed up and linked.  I should be able to do it this week-end if no-one does it first.
msg119955 - (view) Author: Dev Player (devplayer) Date: 2010-10-30 02:43
Another thing I've noticed that makes the issue more complicated (or perhaps less complicated depending on your view).

When running the python.exe at the DOS prompt (in a window on WinXP), then issuing the help() then modules commands, python.exe seems to hang at times, when it doesn't crash. However this apparent hang sometimes seems to be related to the attached "help" child window/dialog popup instantating with "focus" behind the DOS window. This popup with the focus (and behind it's parent window and being modal) prevents the mouse from moving the DOS window (holding the running python.exe) from being moved.  The -sometimes- solution to this "apparent" hang is ALT-TAB back to the DOS window which will put the help-modal-dialog on top of said DOS window (which is running Python).
msg120007 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-10-30 18:45
Éric, go ahead and consolidate to one issue if you can get to it.
Do the other issues shows problems with 3.1 or 3.2 also? I wonder because I have never seen the box in the posted .png and wonder if that is a new 'feature' with 2.7 and possibly 3.2 that was not in 3.1 and possibly the cause. Has anyone posted a 'corrupt module' that reliably reproduces the problem? It is hard to investigate when 'help> modules' works just fine, as it does on my 3.1.2 install.

'Dev': your original post is way too long. The welcome message and module lists could have been snipped to one line plus ellipsis. Example:

>>> help()

Welcome ....
[snip]

help> modules

Please wait....
[snip]

and continue with traceback.
msg125149 - (view) Author: Dev Player (devplayer) Date: 2011-01-03 01:36
import win32ui
from win32ui import GetMainFrame

dir(win32ui.GetMainFrame)
['__call__', '__class__', '__cmp__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']

dir(GetMainFrame)
['__call__', '__class__', '__cmp__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']


Is this normal? I'd expect at least GetWindowText() in the dir().
msg125150 - (view) Author: Dev Player (devplayer) Date: 2011-01-03 01:41
from GetMainFrame import GetWindowText
Traceback (most recent call last):
  File "<input>", line 1, in <module>
ImportError: No module named GetMainFrame


Also, I installed from the MS-Windows installer file:
pywin32-214.win32-py2.7.exe

not from "pywin32-214.zip" which I think is the source distrobution.

I've tried reinstallation but I get the same results.
msg125151 - (view) Author: Dev Player (devplayer) Date: 2011-01-03 01:46
Oh I am running on an Intel Pentium 4 3.2GHz/3.2Ghz.
Windows XP Pro SP3 32 bit
So I presume I should not have used the AMD 64 versions of course.

http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/
msg125168 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-01-03 13:44
Dev: I have no idea how what you just posted relates to the subject of this issue.  Could you clarify please?
msg125242 - (view) Author: Dev Player (devplayer) Date: 2011-01-03 21:13
It was suggested that a corrupt package would be where I'm experiencing the
lockup or crash of python.exe when issuing help() and then "modules". And
that if I or someone could verify that a corrupt package has this effect by
creating a corrupt package. I have not figured out how to make a package let
a lone a corrupt one. I think the following traceback points to my pywin32
being corrupt. Although I've downloaded that package from sourceforge more
then twice and reinstalled that package.

I included the information in the previous posts in case it helps in the
following mannger;
I expect others here in this forum are likely to have pywin32 version 214
installed. They could compare what I get from the traceback (returned when
using help() modules) the "dir(win32ui.GetMainFrame)" with what they have.
So that if they get something different with their dir(win32ui.GetmainFrame)
then we at least are more sure of where this issue is occuring.

Why does python.exe help() fail when an object, in this case win32ui, in the
traceback does not have a certain attribute, GetMainframe?

The dir() outputs in my previous posts show an object pywin32 package
doesn't have all the expected member attributes. It calls
win32ui.GetMainFrame.GetWindowText() method which doesn't exist.

Why would help() fail on that?
I'm no expert but I figured the information could help point someone in the
right direction.

BTW I've created a ticket in the pywin32 at sourceforge.net. - Because I
only suspect it's a corrupt package, I'm not sure and thought others there
would be able to tell me if it's the distro file or my installation.

Traceback reprinted:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "Q:\Python27\lib\site.py", line 453, in __call__
    return pydoc.help(*args, **kwds)
  File "Q:\Python27\lib\pydoc.py", line 1723, in __call__
    self.interact()
  File "Q:\Python27\lib\pydoc.py", line 1735, in interact
    request = self.getline('help> ')
  File "Q:\Python27\lib\pydoc.py", line 1746, in getline
    return raw_input(prompt)
  File "Q:\Python27\Lib\site-packages\pythonwin\pywin\framework\app.py",
line 367, in Win32RawInput
    ret=dialog.GetSimpleInput(prompt)
  File "Q:\Python27\Lib\site-packages\pythonwin\pywin\mfc\dialog.py", line
223, in GetSimpleInput
    if title is None: title=win32ui.GetMainFrame().GetWindowText()
error: The frame does not exist
msg134571 - (view) Author: Dev Player (devplayer) Date: 2011-04-27 14:48
mhammond added a recent note at:

python.exe help() modules crashes - ID: 3150027 
https://sourceforge.net/tracker/?func=detail&aid=3150027&group_id=78018&atid=551954

Scroll down below the detail and click the "Comments" link. View the  note from mhammond's on 4/24/2011. 

Although this note will likely solve my particular problem, I suspect it does not directly solve "any corrput package" that would cause "python.exe" "help()" "modules" to crash or "appear to crash" (i.e. the modal popup appearing behind it's parent window).
msg134594 - (view) Author: Dev Player (devplayer) Date: 2011-04-27 16:31
What about this application modal popup window appearing behind the DOS window? (See attached) That popup window may only need to have a system style flag to push it to the top of the window z-order stack.

What causes that popup to appear? Is it Python source code or compiled C code built into python.exe?

There is a MS-Windows win32 function called SetForegroundWindow() that may be the issue if it's not Python source code.
Maybe this URL might shed some light on the popup issue?

http://stackoverflow.com/questions/3772233/win32-setforegroundwindow-unreliable

I am grasping for straws here.

Perhaps the python.exe app crashes in the cmd.exe window because of attempts to do something with the cmd.exe window while the app modal popup windows is behind it? 

As per my previous post is seems mhammond has a solution for his pythonwin package causing python.exe-help()-modules to crash. (If that's the case) it still doesn't address "other" packages having the same ability to crash python.exe, IDLE and other interactive interpreters thru help()-modules.
msg134608 - (view) Author: Dev Player (devplayer) Date: 2011-04-27 18:30
Just delete the previous message... please.
msg134609 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-04-27 19:29
(Note: the word is 'separate', 2 e's and 2 a's, not 'seperate')
(Note: We already know that using unbound unquoted names does not work. Please do not waste our time telling us the obvious.)
(Note: I am removing IDLE because this does not seem to be an IDLE issue but a help() issue. I marked 'Library' because 'help' is installed by the site module.)

Help is not built in to python.exe. It is added to builtins when the site module is imported. That import can be suppressed with the '-S' startup option. It is strictly intended for interactive use.

I do not see this as much of a security issue. Crashing apps and especially servers should not be an issue because neither should be using help. Anyway, I should think that a hacker that can install a broken C extension could do much worse things.

Help has three modes.
1) the direct response mode of help(ob)
2) the direct response mode of help(somestring), where help looks to see if it recognizes somestring before returning help for str.
help('modules') works fine.
3) the mini-interpreter mode of help(). People can run the mini-interpreter in a separate interactive instance of the interpreter if they wish. I do not think this needs to be done automatically.

I am inclined to close this issue as I do not see any action needed by Cpython developers. Contrary to your assertion, running corrupt C-coded extensions *does* crash the process, and I do not think there is much we can do about it, as C lacks try:...except:. Certainly, there is no promise to guard against such. In my view, removing a corrupt package is an answer, not a workaround!
msg192061 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-06-30 05:34
This issue still seems to be about bad extension modules crashing CPython and we cannot fix that.
History
Date User Action Args
2013-06-30 05:34:25terry.reedysetstatus: pending -> closed
resolution: wont fix
messages: + msg192061

stage: resolved
2012-12-27 19:07:07r.david.murraylinkissue16794 superseder
2012-10-15 11:52:30serhiy.storchakasetstatus: open -> pending
nosy: + serhiy.storchaka
2011-04-27 23:39:48eric.araujosetnosy: + haypo
2011-04-27 19:29:53terry.reedysetmessages: + msg134609
components: + Library (Lib), - IDLE
2011-04-27 19:29:19terry.reedysetmessages: - msg134607
2011-04-27 18:30:13devplayersetmessages: + msg134608
2011-04-27 18:02:52devplayersetmessages: + msg134607
2011-04-27 16:31:05devplayersetfiles: + python_exe_help()_modules_app_modal_popup_window_behind_main_window_a.png

messages: + msg134594
2011-04-27 14:48:30devplayersetmessages: + msg134571
2011-01-03 21:13:12devplayersetfiles: + unnamed

messages: + msg125242
2011-01-03 13:44:56r.david.murraysetmessages: + msg125168
2011-01-03 01:46:37devplayersetmessages: + msg125151
2011-01-03 01:41:40devplayersetmessages: + msg125150
2011-01-03 01:36:00devplayersetmessages: + msg125149
2010-10-30 18:45:34terry.reedysetmessages: + msg120007
2010-10-30 02:43:24devplayersetfiles: + python_help_modules_help_dialog.png

messages: + msg119955
2010-10-21 22:27:32eric.araujosetnosy: + eric.araujo
messages: + msg119345
2010-10-15 19:08:27terry.reedysetnosy: + terry.reedy
messages: + msg118822
2010-10-15 19:07:47terry.reedysetfiles: - unnamed
2010-10-12 00:47:31devplayersetfiles: + unnamed

messages: + msg118397
2010-10-11 17:43:22r.david.murraysetmessages: + msg118380
2010-10-11 14:23:49devplayersetmessages: + msg118362
2010-10-10 04:10:16r.david.murraysetnosy: + r.david.murray
messages: + msg118301
2010-10-10 02:03:45devplayercreate