wx.DirDialog on MacOSX

What version of wxPython? If 2.9.x then are you using the carbon or the cocoa build?

Of course there is an easy workaround, you can just call os.chdir(_selectedDir) yourself.

···

On 11/7/12 10:36 AM, nosirfur wrote:

Hi,

I am new in this group and a wx-beginner.
I had a look on the old posts about wx.DirDialog issues but I could not
find a solution for the following problem I have.

The small piece of code attached below should (in my intention) tell the
system to change directory to the "_selectedDir" folder.
In the following part of the code (not shown) some commands should be
executed in the folder "_selectedDir" which contains some input files.
The code does work on Linux (the system changes directory, inputs are
found and commands properly executed).
But the code does NOT work on MacOSX since I get an error message
stating that the input files cannot be found. I did some cross check
printing out the 'pwd' and I find that the directory did not change.

"
   def SetDir(self,event):
     dialog = wx.DirDialog(self, "Please choose your project directory:",\
     defaultPath=userPath,style=wx.DD_CHANGE_DIR , pos = (10,10))
     if dialog.ShowModal() == wx.ID_OK:
       _selectedDir = dialog.GetPath()
       return _selectedDir
     else:
       _userCancel = dialog.Destroy()
       return _userCancel
     dialog.Destroy()
"
Maybe my code is not properly written?

--
Robin Dunn
Software Craftsman

Hi

Thank you for the reply.
I’m using wxPython2.9-osx-2.9.4.0-cocoa-py2.7.

Anyhow the"os.chdir(_selectedDir)" works.
Thanks!

···

Il giorno venerdì 9 novembre 2012 02:14:51 UTC+1, Robin Dunn ha scritto:

On 11/7/12 10:36 AM, nosirfur wrote:

Hi,

I am new in this group and a wx-beginner.

I had a look on the old posts about wx.DirDialog issues but I could not

find a solution for the following problem I have.

The small piece of code attached below should (in my intention) tell the

system to change directory to the “_selectedDir” folder.

In the following part of the code (not shown) some commands should be

executed in the folder “_selectedDir” which contains some input files.

The code does work on Linux (the system changes directory, inputs are

found and commands properly executed).

But the code does NOT work on MacOSX since I get an error message

stating that the input files cannot be found. I did some cross check

printing out the ‘pwd’ and I find that the directory did not change.

"

def SetDir(self,event):

 dialog =  wx.DirDialog(self, "Please choose your project directory:",\
 defaultPath=userPath,style=wx.DD_CHANGE_DIR , pos = (10,10))
 if dialog.ShowModal() == wx.ID_OK:
   _selectedDir = dialog.GetPath()
   return _selectedDir
 else:
   _userCancel = dialog.Destroy()
   return _userCancel
 dialog.Destroy()

"

Maybe my code is not properly written?

What version of wxPython? If 2.9.x then are you using the carbon or the
cocoa build?

Of course there is an easy workaround, you can just call
os.chdir(_selectedDir) yourself.


Robin Dunn

Software Craftsman

http://wxPython.org