In article <aanlktimruhticd07t-shacgp3rgd3o4sej8fsk7af...@mail.gmail.com>, neoethical <neoethi...@gmail.com> wrote: > New to programming and after doing some research I've chosed to work with > Python. One thing that's bothering me is that I would like to set up a > specific folder in my Documents folder to hold my modules. How do I go about > doing this? I've found the way to change it for each IDLE session but I'd > like to make it check the folder automatically. I've done a bunch of > searches and have come up with nothing helpful.
On OS X, depending on which version of Python you are using, there are usually two ways to start IDLE: either by launching IDLE.app (often found in /Applications/Python x.y or /Applications/MacPython x.y) or by invoking IDLE from the command line (generally something like /usr/local/bin/idlex.y). When started from a terminal command line, IDLE uses the current working directory ("folder") as the default for opening and saving files from the shell window. When you "launch" IDLE.app (by double-clicking on its icon, for example), it always uses Documents as the default working directory. Unfortunately, AFAIK, there is no built-in way to specify a different default for the shell window, which is a bit annoying. The simplest way to work around it, I think, would be to always start IDLE from the command line after changing to the desired default directory. So, from a terminal session (in Terminal.app or equivalent), something like this for, say, python3.1 installed from python.org: cd /path/to/default/directory /usr/local/bin/idle3.1 The equivalent could be turned into a shell function or alias or an AppleScript app or Automator action. >From the command line, you can also give IDLE a list of one or more files to open, each in its own file window. When the focus is on a file window, file command such as open and save default to the directory of the opened file (this is also true in IDLE.app). So you could have something like this: cd /path/to/project/directory /usr/local/bin/idle3.1 my_mod_1.py my_mod_2.py ... or, if you want to edit all of the python modules in a directory: cd /path/to/project/directory /usr/local/bin/idle3.1 *.py You can achieve a similar effect (except for the shell window) in the Finder by dragging the files to the IDLE.app icon (in a Finder window or on the dock). Double-clicking on the .py files themselves can be made to work but it's a bit of a crap shoot which version of IDLE or other app might actually be launched; it's best to avoid depending on that mechanism. -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list