Which directory should requests and openpyxl modules be installed to?

eryk sun eryksun at gmail.com
Mon Apr 3 23:57:11 EDT 2017


On Tue, Apr 4, 2017 at 1:45 AM, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
>
> C:\Users\Wulfraed>assoc .py
> .py=Python.File
>
> C:\Users\Wulfraed>ftype python.file
> python.file="C:\Python27\python.exe" "%1" %*

The Windows shell stores the user file-association choice in
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.py\UserChoice.
The cmd shell's assoc and ftype commands only modify a subset of
system associations in HKLM\Software\Classes. If keys with the same
names exist in HKCU\Software\Classes (e.g. Python and the launcher
were installed just for the current user), they will override the
system associations. Moreover, the user may be using a totally
different ProgId -- usually due to misconfiguration, which is
unfortunately all too common of a problem.

A couple of common misconfigurations are
HKCU\Software\Classes\py_auto_file and
HKCU\Software\Classes\Applications\python.exe. These get created
automatically by the Windows shell, and will almost always have a
broken "open" command that doesn't pass command-line arguments. By
using these ProgIds you're also missing the new drop handler that
Steve Dower wrote to support dropping files with non-ANSI names. It's
best to switch back to using Python.File, Python.NoConFile and
friends.

The UserChoice key is doubly secured via its "Hash" value plus a
security descriptor that prevents the current user from modifying
values in the key. This is to prevent direct modification. The most
you can do in code is to delete the key to have the shell reset from
defaults. By design, the only way to directly change the user choice
is via the GUI. Use the Control Panel's "Default Programs" app. Select
"Associate a filetype or protocol...". Type ".py" to advance in the
list, double-click on the entry, and select the app to use. If
Python.File is configured to use the launcher, the "Python" entry in
this application list should have an icon with a rocket on it.


More information about the Python-list mailing list