473,505 Members | 14,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

popen pipes fail when cwd is a UNC path

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
Jul 18 '05 #1
2 3412
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"
m.********@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Jul 18 '05 #2
In article <ch**********@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
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1033
by: Mark Sandler | last post by:
Hi, When i create a process using popen and then if i decide that i am not interested in keeping the process pipes anymore, and I forget the correspond variables . Then, if python tries to destroy...
4
2045
by: Kevin Walzer | last post by:
I'm trying to structure a Python script that streams output over a pipe. Here is my code: import os cmd = os.popen('echo foo | sudo -S /usr/sbin/tcpdump -en1') cmd.read() This returns...
2
3468
by: hubritic | last post by:
I am trying to set off commands on Windows 2003 from python. Specifically, I am trying to use diskpart with a script file (pointed to with path). cmd = p = Popen(cmd, shell=True) The script...
13
5079
by: bayer.justin | last post by:
Hi, I am trying to communicate with a subprocess via the subprocess module. Consider the following example: <subprocess.Popen object at 0x729f0> Here hey is immediately print to stdout of...
8
2877
by: dmoore | last post by:
Hi folks, I've seen the following issue come up in multiple posts to this mailing list: I have a python program that spawns a child process with popen or popen2 or popen3 or popen2.popen2...
3
1700
by: Ratko | last post by:
Hi all, I have a python gui app that launches multiple applications using subprocess.Popen class and prints their output in the gui (using PIPEs, threads and wxPython). Everything works great...
3
5022
by: DBC User | last post by:
Hi all, I would like to know is there a way to find out if any named pipes are running in a box. How can I go about doing that? Or is there a way to find out if a particular named pipe already...
25
2747
by: Jeremy Banks | last post by:
Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the...
1
8531
by: Mark Shewfelt | last post by:
Hello, I am attempting to use Popen() in a Windows service. I have a small Win32 .exe that I normally run through the os.popen2() function. I've written a class to work with the input and output...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.