[New-bugs-announce] [issue5098] Environ doesn't escape spaces properly

Stuart Axon report at bugs.python.org
Thu Jan 29 15:41:59 CET 2009

New submission from Stuart Axon <stu.axon at gmail.com>:

os.environ doesn't escape spaces, but does backslashes and others

In the windows python interpreter I echo'd the variable 'ProgramFiles',
then in the commandprompt.

>>> from os import environ
>>> environ['ProgramFiles']
'C:\\Program Files'
>>> ^Z

[C:\]echo %ProgramFiles%
C:\Program Files

This 'half' escapping seems odd, and is annoying when building file
paths for instance, probably the space should also be escaped.

components: None
messages: 80765
nosy: stuaxo
severity: normal
status: open
title: Environ doesn't escape spaces properly
type: behavior
versions: Python 2.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list