Excute script only from another file

Chris Angelico rosuav at gmail.com
Tue Nov 26 18:09:13 EST 2013


On Wed, Nov 27, 2013 at 4:25 AM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
> On Tue, 26 Nov 2013 13:41:07 +1100, Chris Angelico <rosuav at gmail.com>
> declaimed the following:
>
>>
>>Totally sure-fire. Absolutely prevents any execution until it's
>>renamed. By the way, what does "associate" mean, and what does it have
>>to do with file names?
>>
>         Windows-speak...
>
>         Where UNIX/Linux relies upon the first line of a script to identify
> what executable is used to process it (the #! line), Windows uses a linked
> pair of registry entries

Yeah. It's usually a GUI feature, not a command-line one, and it
certainly has nothing to do with preventing execution - it is strictly
a convenience. In the OS/2 WorkPlace Shell, you can associate files
with programs by either a filename pattern (which doesn't have to be
star-dot-something - I've always had an association "Makefile.*"),
file type (not MIME type - this system predates that - but a category
that files can be added to), object class (when a file is created, it
can be a subclass of WPFile, like DeScribeDocument), or manually on an
individual file, which is then stored as an extended attribute on that
file. But it's still nothing more than a shortcut - it lets you put a
program into the "Open ->" menu, and (optionally) choose one program
from said menu to be the default, which is run when you double-click
on the file's icon (or call the associated method on the file's object
- everything in the WPS is an object, and naturally any program can
send any object any method). Deleting or breaking an association
doesn't stop you dragging the icon onto the program - which is
sometimes necessary in situations where information isn't properly
carried through. It certainly does not stop Python from executing a
script.

My point was that Rick had made the assumption that the GUI was
*everything* and that users were able to do nothing beyond
double-clicking on icons - and that he did not mention this
assumption, suggesting he was unaware that he had made it.

ChrisA



More information about the Python-list mailing list