This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ned.deily
Recipients George.Patterson, amaury.forgeotdarc, ned.deily
Date 2011-06-03.03:14:52
SpamBayes Score 7.65511e-10
Marked as misclassified No
Message-id <1307070894.68.0.730823221753.issue12247@psf.upfronthosting.co.za>
In-reply-to
Content
The difference in behavior you are seeing does indeed have to do with the PATH environment variable.  When you start IDLE via a terminal shell, it inherits the PATH value from your shell environment.  path_helper(8) sets the default value for a login shell PATH by consulting the entries in /etc/paths.d/. On OS X 10.6, that includes /usr/X11/bin, which is where xterm is located.  However, when you launch IDLE from the Finder, either by double-clicking on the IDLE app icon or by opening a file using IDLE as the default app (as you are doing in test 1), a shell is not involved and the PATH inherited by the app environment is slightly different.  In paticular, /etc/paths.d is not consulted and so /usr/X11/bin is not on the path.  As Amaury suggested, you should be able to see that by looking at PATH in both cases.  For IDLE.app launched from the Finder, you'll probably see something like:

   >>> os.environ['PATH']
   '/usr/bin:/bin:/usr/sbin:/sbin'

While it is possible to change the default environment variables for processes launched (see http://developer.apple.com/library/mac/#qa/qa1067/_index.html), it is rarely necessary or desirable to do that.  For this case, the simplest solution is to supply the absolute path to 'xterm':

  import subprocess
  subprocess.Popen(['/usr/X11/bin/xterm'])

Or you could get fancier by modifying PATH yourself.
History
Date User Action Args
2011-06-03 03:14:54ned.deilysetrecipients: + ned.deily, amaury.forgeotdarc, George.Patterson
2011-06-03 03:14:54ned.deilysetmessageid: <1307070894.68.0.730823221753.issue12247@psf.upfronthosting.co.za>
2011-06-03 03:14:54ned.deilylinkissue12247 messages
2011-06-03 03:14:52ned.deilycreate