New submission from Donald Wallace Rouse II <python-bugs-as92...@dwr2.org>:
Python 2.7 programs crash on startup due to a defective third-party package installed in site-packages. starting python 2.7 yields the following error message: Traceback (most recent call last): File "/usr/lib64/python2.7/site.py", line 554, in <module> main() File "/usr/lib64/python2.7/site.py", line 537, in main known_paths = addsitepackages(known_paths) File "/usr/lib64/python2.7/site.py", line 316, in addsitepackages addsitedir(sitedir, known_paths) File "/usr/lib64/python2.7/site.py", line 192, in addsitedir addpackage(sitedir, name, known_paths) File "/usr/lib64/python2.7/site.py", line 162, in addpackage exec line File "<string>", line 1, in <module> KeyError: 'zope' A similar message appears when starting python2.7 interactively, but it then proceeds to the prompt (doesn't crash). In the file .../python2.7/site.py, at about line 162, in the function "addpackage", you have an unprotected "exec" line: if line.startswith(("import ", "import\t")): exec line If the execution of the line fails, python generates an uncaught exception. This places python at the mercy of bugs in third-party software. The "exec" line should be bracketed by "try/except" to catch such errors: if line.startswith(("import ", "import\t")): try: exec line except: pass continue Note 1: I am not sure whether this is a Distutils bug or Distutils2 bug (or even something else like "Extension Modules"), so I'm filing it under Distutils2. If this is incorrect, please forward to the proper place. Thanks. Note 2: Here is where I initially reported this problem: http://bugs.gentoo.org/show_bug.cgi?id=347565 ---------- assignee: tarek components: Distutils2 messages: 123519 nosy: dwr2, eric.araujo, tarek priority: normal severity: normal status: open title: site.py crashes on python startup due to defective .pth file type: crash versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10642> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com