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 2012-12-21 17:06 by christian.heimes. 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
2012-12-21 17:06:32christian.heimessetstatus: open -> closed

nosy: + christian.heimes
messages: + msg177882

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