Re: os.walk return hex excapes
- From: "Leo Kislov" <Leo.Kislov@xxxxxxxxx>
- Date: 28 Nov 2006 03:45:59 -0800
Alex S wrote:
Hi,
os.walk return hex excape sequence inside a files name, and when i try
to feed it back to os.remove i get
OSError: [Errno 22] Invalid argument:
'C:\\Temp\\?p?\xbfS\xbf\xac?G\xaba ACDSee \xbb?a??n a???\xac\xb5\xbfn.exe'
It's not escape sequences that are the problem but question marks, I
suspect. Most likely this file name contains characters not in your
locale's language. To access this file name you need to use unicode,
just make sure the first parameter of os.walk is a unicode string, for
example: os.walk(u'c:\\temp'). The exact code how to make the first
parameter unicode depends on where it is coming from (network, config
file, registry, etc...) Reading unicode tutorial is highly recommended.
-- Leo
.
- References:
- os.walk return hex excapes
- From: Alex S
- os.walk return hex excapes
- Prev by Date: Re: SAX2 Download
- Next by Date: Re: os.walk return hex excapes
- Previous by thread: os.walk return hex excapes
- Next by thread: Re: os.walk return hex excapes
- Index(es):