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 dabrahams
Recipients brian.curtin, dabrahams, docs@python, mark, r.david.murray
Date 2010-05-16.14:16:28
SpamBayes Score 0.0205976
Marked as misclassified No
Message-id <>
New data point: in some contexts on Windows (not sure of the exact cause but I was dealing with multiple drives), even this workaround isn't enough.  I ended up having to do something like this (i.e. manually search the path) on win32:

    def full_executable_path(invoked, environ):

        if os.path.splitext(invoked)[1]:
            return invoked
        explicit_dir = os.path.dirname(invoked)

        if explicit_dir:
            path = [ explicit_dir ]
            path = environ.get('PATH').split(os.path.pathsep)

        extensions = environ.get(
            # Use *something* in case the environment variable is
            # empty.  These come from my machine's defaults

        for dir in path:
            for ext in extensions:
                full_path = os.path.join(dir, invoked+ext)
                if os.path.exists( full_path ):
                    return full_path

        return invoked # Not found; invoking it will likely fail

    class Popen(subprocess.Popen):
        def __init__(
            self, args, bufsize=0, executable=None,
            stdin=None, stdout=None, stderr=None,
            preexec_fn=None, close_fds=False, shell=False, 
            cwd=None, env=None, 
            *args_, **kw):

            if executable is None and not shell:
                executable = full_executable_path(args[0], env or os.environ)

                args, bufsize, executable, stdin, stdout, stderr, 
                preexec_fn, close_fds, shell, cwd, env, *args_, **kw)
Date User Action Args
2010-05-16 14:16:30dabrahamssetrecipients: + dabrahams, mark, r.david.murray, brian.curtin, docs@python
2010-05-16 14:16:30dabrahamssetmessageid: <>
2010-05-16 14:16:28dabrahamslinkissue8557 messages
2010-05-16 14:16:28dabrahamscreate