A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20110720/a9b88e9d/attachment.html below:

<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#330033">
    On 7/18/2011 6:41 PM, Vinay Sajip wrote:
    <blockquote cite="mid:loom.20110719T031535-263@post.gmane.org"
      type="cite">
      <blockquote type="cite" style="color: #000000;">
        <pre wrap="">&gt;     So I can fix my machine, now that I understand what went wrong
<span class="moz-txt-citetags">&gt; </span>    (delete py.exe entries from HCU, and put them in HLM instead).
<span class="moz-txt-citetags">&gt; </span>    Then the other problem I have, is why py.exe launched py 2.6.4
<span class="moz-txt-citetags">&gt; </span>    instead of py 3.2.1 when 3.2.1 is newer, and I don't have a #!
<span class="moz-txt-citetags">&gt; </span>    line.  That is probably the defined behavior of the launcher, to
<span class="moz-txt-citetags">&gt; </span>    prefer 2.x if 3 isn't specified.  I'll have to reread the launcher
<span class="moz-txt-citetags">&gt; </span>    PEP.  In my environment, I would much prefer to use 3.x if 2.x isn't
<span class="moz-txt-citetags">&gt; </span>    specified... so hopefully when I reread the launcher PEP, I'll
<span class="moz-txt-citetags">&gt; </span>    discover a way to do that.  (I recall one can put -3 on the command
<span class="moz-txt-citetags">&gt; </span>    line, so I could do that in the py.exe ftype commands, but hopefully
<span class="moz-txt-citetags">&gt; </span>    there is a way to tweak the py.ini to do that.)
</pre>
      </blockquote>
      <pre wrap="">Yes, the PEP explains what you need to do to get Python 3 to be the default:
use the py.ini file or use an environment variable.

The use of py from the command line is merely a convenience for developers (as


the PEP says) - it's better to rely on shebang lines together with settings in
the .ini to get the behaviour you want.</pre>
    </blockquote>
    <br>
    OK, took a few minutes to play with the launcher again.  I have
    removed the HCU classes that point at the launcher, leaving me with
    all my Python.File stuff pointing at some version of Python or
    another.  I seem to have Python 2.6.4, Python 3.1, and Python 3.2.1
    installed, all 64-bit.<br>
    <br>
    py.exe is located in c:\Windows\system32.exe, I modified the empty
    py.ini that was installed to contain <br>
    <br>
    Since I don't yet have associations set up that point at the
    launcher, I thought I'd play with saying "py" in front of the
    command.<br>
    <br>
    So I have a command foo.py using Python 3 syntax in a directory on
    my PATH.  It works fine, since Python 3.2.1 is in Python.file. 
    foo.py does not have a #! line.<br>
    <br>
    I can successfully execute:  foo.py<br>
    <br>
    However, the following fails:  py foo.py<br>
    It fails, because foo.py is not found.  Instead, I have to specify:
    py d:\path\to\foo.py<br>
    This is annoying, py should walk the PATH for unqualified files (the
    Windows PATH implicitly includes the current directory, of course,
    but if it were in the current directory, it would just work).<br>
    <br>
    So when I: type c:\windows\system32\py.ini<br>
    I get a set of h2 h3 v2 v3 commands in a section called [commands]. 
    Not sure where my [defaults] went.  Is there some more Windows magic
    to be explained?  WOW6432-ness, perhaps?  Probably my editor is
    running as a 32-bit process, so looked in the wrong
    C:\windows\system32 !!<br>
    <br>
    OK, with that mystery solved, and using Notepad running as
    administrator to actually, successfully edit the file, it still runs
    the wrong version of Python.  Here is the content of the file, what
    is wrong?  And why is the spacing around the = in the [commands]
    section so inconsistent?<br>
    <br>
    [defaults]<br>
    python=3<br>
    <br>
    [commands]<br>
    h2=c:\Python26\python -h<br>
    h3 = c:\Python32\python -h<br>
    v2= c:\Python26\python -V<br>
    v3 =c:\Python32\python -V<br>
    <br>
    <br>
    OK, so when I specify: py d:\path\to\foo.py<br>
    It fails, but this time it is because it launches Python 2.6.4.  So
    the [defaults] section doesn't seem to have an effect.<br>
  </body>
</html>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4