wxPython Application affecting popen OS calls

Yes, os.getcwd() changes to the remote path when I run wxGetFilename to
get a remote filename. It must be os.popen that doesn't like this,
because any popen os command I try afterwards fails when I close the
pipe. Any ideas? I guess I'm getting into the domain of a normal python
list, huh?

Thanks,
Tim

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Wednesday, September 08, 2004 2:51 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] wxPython Application affecting popen OS
calls

Tim Black wrote:

I have recently found that this bug happens only when you choose a

file

on a remote computer. I'd like to know if you can reproduce this. I've
attached my app again at the bottom of this msg.

This is my python.exe session:

f=os.popen("dir"); r=f.read(); print f.close()

None

wxGetFilename() # get a local filename

'C:\\cool.txt'

f=os.popen("dir"); r=f.read(); print f.close()

None

wxGetFilename() # get a remote filename

'\\\\Timb\\Downloads\\Python\\wxPythonWIN32-2.5.2.7-Py23.exe'

f=os.popen("dir"); r=f.read(); print f.close()

1

Also, I have upgraded to Python 2.3.4 and wxPython 2.5.2.7 and I still
get this behaviour.

Take a look at the value of os.getcwd() after doing the wxGetFilename
dialog remote for the remote file. Apparently either os.popen or dir
don't like having a current working directory that is a UNC path.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Tim Black wrote:

Yes, os.getcwd() changes to the remote path when I run wxGetFilename to
get a remote filename. It must be os.popen that doesn't like this,
because any popen os command I try afterwards fails when I close the
pipe. Any ideas? I guess I'm getting into the domain of a normal python
list, huh?

Yep, it has nothing to do with wx:

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.
>>> import os
>>> os.getcwd()
'c:\\'
>>> f=os.popen("dir"); r=f.read(); print f.close()
None
>>> os.chdir("//gate/stuff")
>>> f=os.popen("dir"); r=f.read(); print f.close()
1
>>> os.chdir("c:/")
>>> f=os.popen("dir"); r=f.read(); print f.close()
None

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!