popen pipes fail when cwd is a UNC path

Steve Christensen stnchris at xmission.com
Thu Sep 9 13:53:29 EDT 2004


In article <cho314$4e1$1 at newsreader.mailgate.org>, Mark Hadfield wrote:
> Tim Black wrote:
>> In my recent experience, popen os pipes always fail when cwd is a UNC
>> path. Can anyone shed any light on this? Although I've seen lots of
>> UNC path-related problems in this newsgroup, I've not been able to
>> find anything specifically about os pipes and UNC paths.
> 
> It's a problem with the Windows command interpreter (cmd.exe on the NT 
> family) which gets invoked by popen. To demonstrate this. try cd'ing to 
> a UNC path. You will get a message like
> 
> '\\foo\bar' is an invalid current directory path.  UNC paths are not 
> supported.

It won't be directly applicable to the original problem... But, you can
use 'pushd' on a UNC path. It will temporarily map the UNC path to a
drive letter. When you do a 'popd' it will unmap the drive letter.

-Steve



More information about the Python-list mailing list