FAQ
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.

Here's a session dump that demonstrates what I'm talking about:

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]
on win32
os.getcwd()
'c:\\Python23'
None
os.getcwd()
'c:\\Python23'
os.chdir("c:\\")
os.getcwd()
'c:\\'
None
os.chdir("\\\\Timb\\Python23")
os.getcwd()
'\\\\Timb\\Python23'
1

As you can see, this last pipe fails. This only happens when cwd is a
UNC path. Please let me know if you have seen this, solved this, know
a nice workaround, etc. as I find this quite annoying.

Thanks,
Tim

## Search Discussions

•  at Sep 8, 2004 at 11:01 pm ⇧

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.

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
National Institute for Water and Atmospheric Research (NIWA)
•  at Sep 9, 2004 at 5:53 pm ⇧

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

## Related Discussions

Discussion Overview
 group python-list categories python posted Sep 8, '04 at 10:48p active Sep 9, '04 at 5:53p posts 3 users 3 website python.org

### 3 users in discussion

Content

People

Support

Translate

site design / logo © 2021 Grokbase