popen pipes fail when cwd is a UNC path

Tim Black tblack at biamp.com
Thu Sep 9 00:48:32 CEST 2004


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
Type "help", "copyright", "credits" or "license" for more information.
>>> os.getcwd()
'c:\\Python23'
>>> f=os.popen("dir"); r=f.read(); print f.close()
None
>>> os.getcwd()
'c:\\Python23'
>>> os.chdir("c:\\")
>>> os.getcwd()
'c:\\'
>>> f=os.popen("dir"); r=f.read(); print f.close()
None
>>> os.chdir("\\\\Timb\\Python23")
>>> os.getcwd()
'\\\\Timb\\Python23'
>>> f=os.popen("dir"); r=f.read(); print f.close()
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



More information about the Python-list mailing list