Re: Unicode Chars in Windows Path

2014-04-04 Thread Lele Gaifax
Steven D'Aprano writes: > When working with Windows paths, you should make a habit of either > escaping every backslash: > > u"c:\\automation_common\\Python\\TestCases\\list_dir_script.txt" > > using a raw-string: > > ur"c:\automation_common\Python\TestCases\list_dir_script.txt" > > or j

Re: Unicode Chars in Windows Path

2014-04-03 Thread David
On 4 April 2014 12:16, Chris Angelico wrote: > On Fri, Apr 4, 2014 at 11:15 AM, David wrote: >> On 4 April 2014 01:17, Chris Angelico wrote: >>> >>> -- Get info on all .pyc files in a directory and all its subdirectories -- >>> C:\>dir some_directory\*.pyc /s >>> $ ls -l `find some_directory -na

Re: Unicode Chars in Windows Path

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 11:15 AM, David wrote: > On 4 April 2014 01:17, Chris Angelico wrote: >> >> -- Get info on all .pyc files in a directory and all its subdirectories -- >> C:\>dir some_directory\*.pyc /s >> $ ls -l `find some_directory -name \*.pyc` >> >> Except that the ls version there can

Re: Unicode Chars in Windows Path

2014-04-03 Thread David
On 4 April 2014 01:17, Chris Angelico wrote: > > -- Get info on all .pyc files in a directory and all its subdirectories -- > C:\>dir some_directory\*.pyc /s > $ ls -l `find some_directory -name \*.pyc` > > Except that the ls version there can't handle names with spaces in > them, so you need to f

Re: Unicode Chars in Windows Path

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 5:41 AM, Terry Reedy wrote: > On 4/2/2014 11:10 PM, Chris Angelico wrote: >> >> On Thu, Apr 3, 2014 at 1:37 PM, Steven D'Aprano >> wrote: >>> >>> Windows accepts both forward and backslashes in file names. >> >> >> Small clarification: The Windows *API* accepts both types o

Re: Unicode Chars in Windows Path

2014-04-03 Thread Terry Reedy
On 4/2/2014 11:10 PM, Chris Angelico wrote: On Thu, Apr 3, 2014 at 1:37 PM, Steven D'Aprano wrote: Windows accepts both forward and backslashes in file names. Small clarification: The Windows *API* accepts both types of slash To me, that is what Steven said. (you can open a file using for

Re: Unicode Chars in Windows Path

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 12:57 AM, wrote: > An argument [in a position where a list of filenames is expected] with * > or ? in it _always_ gets globbed, so "C:\dir with spaces\*.txt" can be > used. This is part of the reason the program is responsible for globbing > rather than the shell - because

Re: Unicode Chars in Windows Path

2014-04-03 Thread Peter Otten
Marko Rauhamaa wrote: > Chris Angelico : > >> Small clarification: The Windows *API* accepts both types of slash >> (you can open a file using forward slashes, for instance), but not all >> Windows *applications* are aware of this (generally only >> cross-platform ones take notice of this), and m

Re: Unicode Chars in Windows Path

2014-04-03 Thread random832
On Thu, Apr 3, 2014, at 5:00, Marko Rauhamaa wrote: > In fact, proper dealing with punctuation in pathnames is one of the main > reasons to migrate to Python from bash. Even if it is often possible to > write bash scripts that handle arbitrary pathnames correctly, few script > writers are pedantic

Re: Unicode Chars in Windows Path

2014-04-03 Thread Marko Rauhamaa
Chris Angelico : > Small clarification: The Windows *API* accepts both types of slash > (you can open a file using forward slashes, for instance), but not all > Windows *applications* are aware of this (generally only > cross-platform ones take notice of this), and most Windows *users* > prefer ba

Re: Unicode Chars in Windows Path

2014-04-03 Thread alister
On Wed, 02 Apr 2014 16:27:04 -0700, Steve wrote: > Hi All, > > I'm in need of some encoding/decoding help for a situation for a Windows > Path that contains Unicode characters in it. > > CODE > > import os.path import codecs import sys > > All_Tests = > [u"c:\automation_common\Python

Re: Unicode Chars in Windows Path

2014-04-02 Thread Chris Angelico
On Thu, Apr 3, 2014 at 1:37 PM, Steven D'Aprano wrote: > Windows accepts both forward and backslashes in file names. Small clarification: The Windows *API* accepts both types of slash (you can open a file using forward slashes, for instance), but not all Windows *applications* are aware of this (

Re: Unicode Chars in Windows Path

2014-04-02 Thread Steven D'Aprano
On Wed, 02 Apr 2014 16:27:04 -0700, Steve wrote: > Hi All, > > I'm in need of some encoding/decoding help for a situation for a Windows > Path that contains Unicode characters in it. > > CODE > > import os.path > import codecs > import sys > > All_Tests = > [u"c:\automation_common\Py

Unicode Chars in Windows Path

2014-04-02 Thread Steve
Hi All, I'm in need of some encoding/decoding help for a situation for a Windows Path that contains Unicode characters in it. CODE import os.path import codecs import sys All_Tests = [u"c:\automation_common\Python\TestCases\list_dir_script.txt"] for curr_test in All_Tests: