osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Check Python version from inside script? Run Pythons script in v2 compatibility mode?


On Fri, Jul 7, 2017 at 3:49 PM,  <sohcahtoa82 at gmail.com> wrote:
> Is there any particular reason the Windows python does it that way?  Certainly it wouldn't be too difficult to include a "python2.exe" and "python3.exe", even as symbolic links.

Windows associates file types with applications by extension. When you
double click on "holygrail.py" should it open with python2.exe or
python3.exe? In Unix this is solved with a shebang, so the main
purpose of py.exe is to do the same: it's the standard open handler
for .py files and it delegates out the actual execution to the
appropriate Python version by examining the file for version hints.