This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Malcolm Smith
Recipients Malcolm Smith
Date 2018-05-29.23:03:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527634994.48.0.682650639539.issue33689@psf.upfronthosting.co.za>
In-reply-to
Content
The `site` module documentation says that in .pth files, "Blank lines and lines beginning with # are skipped.". However, the implementation does not actually skip blank lines. It then joins the empty string to the site-packages directory, resulting in the site-packages directory being added to sys.path a second time.

Example:

$ python -c 'import sys; print(sys.path)'
['', '/home/smith/.virtualenvs/foo/lib/python36.zip', '/home/smith/.virtualenvs/foo/lib/python3.6', '/home/smith/.virtualenvs/foo/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/smith/.virtualenvs/foo/lib/python3.6/site-packages']
$ echo > /home/smith/.virtualenvs/foo/lib/python3.6/site-packages/test.pth
$ python -c 'import sys; print(sys.path)'
['', '/home/smith/.virtualenvs/foo/lib/python36.zip', '/home/smith/.virtualenvs/foo/lib/python3.6', '/home/smith/.virtualenvs/foo/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/smith/.virtualenvs/foo/lib/python3.6/site-packages', '/home/smith/.virtualenvs/foo/lib/python3.6/site-packages']

A patch fixing this is attached to issue 29326, but was ignored when that issue turned out to be caused by something else.
History
Date User Action Args
2018-05-29 23:03:14Malcolm Smithsetrecipients: + Malcolm Smith
2018-05-29 23:03:14Malcolm Smithsetmessageid: <1527634994.48.0.682650639539.issue33689@psf.upfronthosting.co.za>
2018-05-29 23:03:14Malcolm Smithlinkissue33689 messages
2018-05-29 23:03:14Malcolm Smithcreate