Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Sure you can. You were very close to answer in your comment to Jakob's answer - </p> <blockquote> <p>If it is possible to change file association with environment variables - it will help, but it doesn't seem possible.</p> </blockquote> <p>It is possible. All you have to do is to use <code>REG_EXPAND_SZ</code> type of registry key and environment variable in the key's value. For example putting<br> <code>%python_home%\python %1 %*</code><br> as the <code>(Default)</code> value of<br> <code>HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Python.File\shell\open\command</code><br> key and setting its value to <code>REG_EXPAND_SZ</code> makes it possible to define what Python your Python files will be opened with. You decide by setting <code>python_home</code> environment variable and you can do this per command line session of course. Take a look at my answer to the question <a href="https://superuser.com/questions/266268/">where in the registry does Windows store, with which program to open certain file types?</a> </p> <p>Having said that there is now special tool for solving exactly this problem which I highly recommend. It's called <a href="https://bitbucket.org/vinay.sajip/pylauncher/overview" rel="nofollow noreferrer">pylauncher</a>. From the docs:</p> <blockquote> <p>PEP 397 compatible launcher for Python under Windows. See <a href="http://www.python.org/dev/peps/pep-0397/" rel="nofollow noreferrer">http://www.python.org/dev/peps/pep-0397/</a> for PEP, <a href="http://www.red-dove.com/screencasts/launcher/launcher.html" rel="nofollow noreferrer">http://www.red-dove.com/screencasts/launcher/launcher.html</a> for screencast</p> </blockquote> <p>You can even skip the <em>.py</em> extension if you add it to the <em>PATHEXT</em> environment variable. See the question <a href="https://superuser.com/questions/101596/">What environment variables will be used when calling an EXE from command line?</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload