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.

classification
Title: site.py should ignore trailing CRs in .pth files
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, d_everhart
Priority: normal Keywords:

Created on 2003-03-08 19:39 by d_everhart, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Messages (3)
msg15045 - (view) Author: Dan Everhart (d_everhart) Date: 2003-03-08 19:39
When site.addpackage(), running on a posix (e.g. 
cygwin or linux) system, reads lines from a .pth file that 
have '\r\n' line terminators, the carriage return character 
interferes with both the import operation and the 
directory appending operation.

The situation can arise, for example, when .pth files 
reside on a network directory that is shared between 
Windows and Posix installations and accessed by 
python interpreters running in both environments.

Suggested change:
replace site.py line 146:
        dir = f.readline()
with
        dir = f.readline().rstrip()
This change also eliminates the need for removing the 
newline at lines 154-155


msg15046 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-06-08 21:26
Logged In: YES 
user_id=357491

Would opening the file with universal newlines solve the issue?
msg15047 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2004-03-20 21:28
Logged In: YES 
user_id=357491

Fixed Lib/site.py as rev. 1.58 in Python 2.4 and rev. 1.53.6.5 in Python 
2.3 .
History
Date User Action Args
2022-04-10 16:07:30adminsetgithub: 38131
2003-03-08 19:39:37d_everhartcreate