[issue17280] path.basename and ntpath.basename functions returns an incorrect file name in Windows 7

2013-02-23 Thread Eric V. Smith

Changes by Eric V. Smith :


--
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17280] path.basename and ntpath.basename functions returns an incorrect file name in Windows 7

2013-02-23 Thread STINNER Victor

STINNER Victor added the comment:

> print os.path.basename ("C:\Users\Alkor\Desktop\a3434.raw")

Ah, it's a common trap of the Python syntax (and PHP, and C, and ... 
languages). "\" is a special character, you have to escape it: "\\".

"C:\\Users\\Alkor\\Desktop\\a3434.raw"

or simply use the "raw" string syntax:

r"C:\Users\Alkor\Desktop\a3434.raw"

--
nosy: +haypo
resolution:  -> invalid

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17280] path.basename and ntpath.basename functions returns an incorrect file name in Windows 7

2013-02-23 Thread Alex

New submission from Alex:

1. I created file ("C:\Users\Alkor\Desktop\a3434.raw") on my desktop 
2. Tried to get the file name from the absolute path

Actual result:
C:\Users\Alkor>python
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print os.path.basename ("C:\Users\Alkor\Desktop\a3434.raw")
Desktop3434.raw

The same for ntpath module:
>>> import ntpath
>>> print ntpath.basename ("C:\Users\Alkor\Desktop\a3434.raw")
Desktop3434.raw

Expected result:
a3434.raw

Environment:
Windows 7 x64 SP1 Ultimate
python 2.7.3150 (64-bit)

--
components: Windows
messages: 182739
nosy: Ternovoy, brian.curtin, loewis, tim.golden
priority: normal
severity: normal
status: open
title: path.basename and ntpath.basename functions returns an incorrect file 
name in Windows 7
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com