On My Python 2.6 ( 64bit, win7, ActivePython ),
when i call:
os.path.abspath('D:/PROJECTS/SuiShouBei/www/ssb/static/voices/en/mp3/con.mp3')
It returns:
'\\\\.\\con'
I have no problem with other paths so far.
Anyone has the same issue?
Can someone please tell me why?
I can reproduce this in Python 2.6, 2.7, 3.1 and 3.2.
The reason for this behavior is the fact that
CONis an illegal filename in Windows (tryos.path.abspath('D:/PROJECTS/SuiShouBei/www/ssb/static/voices/en/mp3/cont.mp3')and see that everything works fine).So take care that your filenames don’t contain
Also do not use the following reserved device names for the name of a file (with or without extension):
As noticed by slowdog, it is mentioned in the same MSDN document as above that
\\.\CONis the correct way to access such a device name directly.