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: sys.path.append causes wrong behaviour
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, rappy
Priority: normal Keywords:

Created on 2012-12-21 17:04 by rappy, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bug.py rappy, 2012-12-21 17:04
Messages (2)
msg177881 - (view) Author: rappy (rappy) Date: 2012-12-21 17:04
In bug.py print gives

['C:\\Users\\Glenn\\Desktop', 'C:\\Windows\\system32\\python27.zip', C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Users\\Glenn\\Documents\\ua\\mosis\x07ssignment6']

What it should give is

['C:\\Users\\Glenn\\Desktop', 'C:\\Windows\\system32\\python27.zip', C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Users\\Glenn\\Documents\\ua\\mosis\assignment6']
msg177882 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2012-12-21 17:06
You have to either quote the backslashes or use raw strings:

>>> "\a"
'\x07'
>>> "\\a"
'\\a'
>>> r"\a"
'\\a'
History
Date User Action Args
2022-04-11 14:57:39adminsetgithub: 60948
2012-12-21 17:06:32christian.heimessetstatus: open -> closed

nosy: + christian.heimes
messages: + msg177882

resolution: not a bug
2012-12-21 17:04:11rappycreate