How to find where data files are installed for my Python program

Chris Angelico rosuav at gmail.com
Sun Oct 27 19:58:36 EDT 2013


On Mon, Oct 28, 2013 at 10:31 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
> It is an unfortunate artefact of Unix history that “binary” has an
> established connotation of “executable”, encompassing even executable
> text files.

That's a lot broader than Unix - people talk about "binaries" meaning
executables in Windows and OS/2 too. Unix is, if anything, _less_
inclined that way - the executable segment is called "text", which
always struck me as a bit odd.

> So the separation I'm drawing attention to in the FHS has nothing to do
> with whether the files are text files, and everything to do with whether
> they're executable programs and code libraries.

Yup. Unix does a fairly good job of blurring the line between
"executables that can be loaded and jumped to" and "scripts that get
loaded by an interpreter". I actually have a few scripts that take
several levels of interpreter, something like:

foo.pike
#!/usr/local/bin/pike

bar.pike:
#!/.../foo.pike --parameter

fum.pike:
#!/.../bar.pike --otherparameter

Unix will happily execute ./fum.pike as "/usr/local/bin/pike
/.../foo.pike --parameter /.../bar.pike --otherparameter ./fum.pike".
There's a limit on the number of interpreters (to prevent loops), but
I haven't hit it :)

There is one important place, though, where scripts are called data
files, and that's licensing. The GPL, for instance, does NOT cover
your scripts, even if it covers the interpreter, because *to the
language interpreter*, your scripts are just data files. But that's
more of a legal distinction than a filesystem hierarchical one.

ChrisA



More information about the Python-list mailing list