On Oct 27, 2013 2:51 AM, "Amit Saha" <amitsaha...@gmail.com> wrote: > > On Sun, Oct 27, 2013 at 2:39 AM, Albert-Jan Roskam <fo...@yahoo.com> wrote: > > Hi, > > > > Why does the "executable" parameter default to sys.executable? Yesterday I > > was surprised to see platform.architecture return "32bit" on a 64-bit > > system, just because a 32-bit Python interpreter was installed. Wouldn't > > this make more sense: > > > > import sys, platform > > pf = sys.platform.lower()[:3] > > executable = "iexplore.exe" if pf[:3] == "win" else "/bin/ls" > > I think it's mainly because of avoiding choosing arbitrary programs, > although they are most certainly guaranteed to be present. Besides, > there are better ways to find the platform architecture, I think. > os.uname() comes to mind.
Although that will lie if you have, for example a 32-bit os installed on a 64-bit system. Then, you can read /proc/cpuinfo and look for the lm flag. If it is present, it is a 64-bit system, else a 32-bit one. This is specific to Intel, i think. > > -Amit.
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor