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

Ian Kelly ian.g.kelly at gmail.com
Fri Jul 7 20:57:20 EDT 2017


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.



More information about the Python-list mailing list