Re: Unicode Chars in Windows Path

2014-04-04 Thread Lele Gaifax
Steven D'Aprano st...@pearwood.info writes: When working with Windows paths, you should make a habit of either escaping every backslash: uc:\\automation_common\\Python\\TestCases\\list_dir_script.txt using a raw-string: urc:\automation_common\Python\TestCases\list_dir_script.txt

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 =

Re: Unicode Chars in Windows Path

2014-04-03 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: 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

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 Peter Otten
Marko Rauhamaa wrote: Chris Angelico ros...@gmail.com: 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

Re: Unicode Chars in Windows Path

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 12:57 AM, random...@fastmail.us 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

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 st...@pearwood.info 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

Re: Unicode Chars in Windows Path

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

Re: Unicode Chars in Windows Path

2014-04-03 Thread David
On 4 April 2014 01:17, Chris Angelico ros...@gmail.com 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

Re: Unicode Chars in Windows Path

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 11:15 AM, David bouncingc...@gmail.com wrote: On 4 April 2014 01:17, Chris Angelico ros...@gmail.com 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

Re: Unicode Chars in Windows Path

2014-04-03 Thread David
On 4 April 2014 12:16, Chris Angelico ros...@gmail.com wrote: On Fri, Apr 4, 2014 at 11:15 AM, David bouncingc...@gmail.com wrote: On 4 April 2014 01:17, Chris Angelico ros...@gmail.com wrote: -- Get info on all .pyc files in a directory and all its subdirectories -- C:\dir

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 =

Re: Unicode Chars in Windows Path

2014-04-02 Thread Chris Angelico
On Thu, Apr 3, 2014 at 1:37 PM, Steven D'Aprano st...@pearwood.info 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*