[GRASS-dev] Handling of Python scripts on MS Windows

Glynn Clements glynn at gclements.plus.com
Wed Oct 9 05:06:49 PDT 2013


Helmut Kudrnovsky wrote:

> C:\tmp\testpython>echo %PATHEXT%
> .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Note that lib/init/grass.py sets PATHEXT.

I was referring to cmd.exe *within* a GRASS session.

> >Then, I would need to see the result of running a python script from
> >the shell (that's cmd.exe in a console window, not bash, or anything
> >running in MSys' rxvt, or the GUI's "command line"). 
> 
> test.py:
> 
> print "Hello, Python!";
> 
> C:\tmp\testpython\test.py
> 
> a error box pops up that test.py can't by executed because of no associated
> program can be found (see echo %PATHEXT%)

This isn't related to PATHEXT. It suggests that the registry keys are
inconsistent.

There are two sets of registry keys used for file associations.

The keys under HKEY_LOCAL_MACHINE\SOFTWARE\Classes contain the
system-wide settings, while those under HKEY_USERS\*\Software\Classes
contain the per-user settings. Additionally, HKEY_CURRENT_USER is an
alias for HKEY_USERS\$user (where $user is the logged-in user) while
HKEY_CLASSES_ROOT is obtained by merging the two sets of *\Classes
keys (with the per-user settings taking precedence).

ftype and assoc show the system-wide settings, but these are ignored
if there are per-user keys. If the per-user keys exist but the values
are invalid, executing a script will result in a dialog asking you to
select the program to open that type of file.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list