Piotr Dobrogost added the comment: > Garbage in, garbage out.
In this case – exec -a '' – yes, but in general not so – see "Mismatch between sys.executable and sys.version in Python" question at SO (http://stackoverflow.com/q/22236727/95735). As to not guessing Victor STINNER in comment http://bugs.python.org/issue7774#msg100849 wrote this: " There are different methods to get the real program name, but no one is portable. As flox wrote, we can "do a best effort to provide a valid sys.executable". Extract of stackoverflow link: * Mac OS X: _NSGetExecutablePath() (man 3 dyld) * Linux: readlink /proc/self/exe * Solaris: getexecname() * FreeBSD: sysctl CTL_KERN KERN_PROC KERN_PROC_PATHNAME -1 * BSD with procfs: readlink /proc/curproc/file * Windows: GetModuleFileName() with hModule = NULL " ---------- nosy: +piotr.dobrogost _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10835> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com