Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-05-01 Thread eryksun
On Fri, May 1, 2015 at 8:03 AM, Albert-Jan Roskam wrote: > I used a str for cmd because I found it more readable that way. I could do > cmd.split(). Don't use cmd.split(). That just splits on whitespace without respecting how the shell tokenizes the command. Use shlex.split(cmd) instead. > So o

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-05-01 Thread Albert-Jan Roskam via Tutor
On Thu, Apr 30, 2015 1:12 AM CEST eryksun wrote: >On Wed, Apr 29, 2015 at 11:54 AM, Albert-Jan Roskam > wrote: >> Hmmm, that sounds pretty convincing indeed (makes it even stranger that CD >> works the way it works). >> I believe it threw a WindowsError, indicating t

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-30 Thread Alan Gauld
On 30/04/15 01:48, eryksun wrote: > Actually cmd.exe is fine with UNC paths. cmd.exe cannot use a UNC path as the current directory. Oops, my mistake. I got my POSIX and UNC mixed up. I was thinking about forward slashes etc not network names. Apologies for not reading the message properly. --

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread eryksun
On Wed, Apr 29, 2015 at 8:28 PM, eryksun wrote: > After disabling the check, my previous example should work fine: Except it doesn't accept paths relative to a UNC working directory: (test) \\127.0.0.1\C$>cd Temp The system cannot find the path specified. And the cd command appears to i

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread eryksun
On Wed, Apr 29, 2015 at 7:48 PM, eryksun wrote: > cmd.exe was developed for OS/2 (1987) to replace COMMAND.COM (1981). Actually, I stand corrected about the reason being cmd's 1980s crustiness. Per [KB156276][1] this check was added to NT 4.0 (1996) to address a vaguely described problem ("a UNC

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread eryksun
On Wed, Apr 29, 2015 at 7:08 PM, Alan Gauld wrote: > On 30/04/15 00:12, eryksun wrote: > >> the working directory, but the cmd.exe shell (being a crusty relic of >> the 1980s) does not. > > Actually cmd.exe is fine with UNC paths. It's only when you > combine them with Windows /option style that i

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Alan Gauld
On 30/04/15 00:12, eryksun wrote: the working directory, but the cmd.exe shell (being a crusty relic of the 1980s) does not. Actually cmd.exe is fine with UNC paths. It's only when you combine them with Windows /option style that it has issues but even then putting the path in quotes will usua

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread eryksun
On Wed, Apr 29, 2015 at 11:54 AM, Albert-Jan Roskam wrote: > Hmmm, that sounds pretty convincing indeed (makes it even stranger that CD > works the way it works). > I believe it threw a WindowsError, indicating that the file(s) could not be > found, because the dir was > not changed. I actually

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Albert-Jan Roskam
- On Wed, Apr 29, 2015 4:11 PM CEST Peter Otten wrote: >Albert-Jan Roskam wrote: > >> Hello, >> >> Windows has the 'feature' that the CD command does not work with UNC >> paths. So in the code below, I cannot use the 'cwd' parameter of >> subprocess.Popen. Therefore I

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Peter Otten
Albert-Jan Roskam wrote: > Hello, > > Windows has the 'feature' that the CD command does not work with UNC > paths. So in the code below, I cannot use the 'cwd' parameter of > subprocess.Popen. Therefore I use pushd/popd to accomplish the same > effect. Is there a better way to do this? (other th

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Dave Angel
On 04/29/2015 08:47 AM, Albert-Jan Roskam wrote: Hello, Windows has the 'feature' that the CD command does not work with UNC paths. So in the code below, I cannot use the 'cwd' parameter of subprocess.Popen. Therefore I use pushd/popd to accomplish the same effect. Is there a better way to do t

[Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Albert-Jan Roskam
Hello, Windows has the 'feature' that the CD command does not work with UNC paths. So in the code below, I cannot use the 'cwd' parameter of subprocess.Popen. Therefore I use pushd/popd to accomplish the same effect. Is there a better way to do this? (other than using full path names everywhere,