[issue5258] addpackage in site.py fails hard on badly formed .pth files

James Wheare report at bugs.python.org
Sat Feb 14 13:36:04 CET 2009


New submission from James Wheare <james at wheare.org>:

As described here: http://james.wheare.org/notes/2009/02/import-site-
failed-use-v-for-traceback.php

The addpackage function will result in a TypeError being raised from os.path.exists(dir) -> from os.stat(path) if the contents of an 
inspected .pth file contain binary data.

This can happen in OS X network environments where ._ AppleDouble files 
are created to store resource forks and file metadata.

As this function is run whenever the interpreter is initialised, Python 
should be robust enough to ignore invalid data in these files, either by 
catching the TypeError in os.path.exists, or by detecting them at a 
higher level, but should be careful of false positives.

Another alternative is to raise a different exception and use it to 
display more helpful debugging info for those not familiar with pdb.

----------
messages: 82032
nosy: jwheare
severity: normal
status: open
title: addpackage in site.py fails hard on badly formed .pth files
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5258>
_______________________________________


More information about the Python-bugs-list mailing list