--- linecache.py.original 2007-07-14 21:00:48.000000000 -0700 +++ linecache.py 2007-07-14 20:59:16.000000000 -0700 @@ -104,7 +104,11 @@ ) return cache[filename][2] - # Try looking through the module search path. + # Try looking through the module search path, taking care to handle packages. + + if basename == '__init__.py': + # filename refers to a package + basename = filename for dirname in sys.path: # When using imputil, sys.path may contain things other than