I am using:
- Windows XP
- Python 2.6.2 (standard install from python.org)
- git version 1.6.5.1-preview20091022 (installed from http://code.google.com/p/msysgit/)
I have an environment variable looking like an absolute path (/path/to/dir
) but I'm using it to construct a git URL. At some point, it's getting translated to C:/Program Files/Git/path/to/dir
. It seems like Python is at fault:
In a git bash shell:
$ export VAR=/path/to/dir
$ echo $VAR
/path/to/dir
$ python
>>> import os
>>> os.environ['VAR']
'C:/Program Files/Git/path/to/dir'
git bash is not translating the path, but Python is?
In a Windows Command Prompt, Python gets it right:
C:\>set VAR=/path/to/dir
C:\>echo %VAR%
/path/to/dir
C:\>python
>>> import os
>>> os.environ['VAR']
'/path/to/dir'
Can anyone explain what's going on here? And how can I prevent the translation in a bash shell?
EDIT: I should add that my python script runs on OS X and Windows, so if anyone does have a solution it would be good if worked on both platforms.