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

Glynn Clements glynn at gclements.plus.com
Thu Oct 3 07:38:12 PDT 2013


Moritz Lennert wrote:

> I understand the frustration, but I do agree with Glynn that sometimes 
> hack solutions are worse than no solution, as they cover (and make us 
> forget) the underlying problem.

They don't just make you forget the underlying problem, they actively
obstruct attempts to actually fix it.

Windows does actually have a mechanism for executing scripts
(otherwise BAT/CMD files wouldn't work: those don't actually get any
special treatment compared to other types of scripts).

That mechanism requires that the interpreter is associated with the
file type, which in turn is associated with the extension. That cannot
be avoided. You might be able to patch the functions in core.py to
work around this requirement, but you can't patch e.g. MSVCRT's
system() function. If the relevant file associations aren't set
correctly, Python scripts will never be fully functional.

Secondly, in order to avoid having to specify the extension when
executing scripts, the extension must be present in PATHEXT. This one
shouldn't be a problem, as the environment is per-process, so the
GRASS start-up script can ensure that PATHEXT is set correctly (unlike
the file associations, which are system-wide).

In the unlikely event that it really is a problem, I'd rather just
keep the extension on all platforms. It's not as if Unix has problems
with dots in filenames.

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


More information about the grass-dev mailing list