[PEAK] Specifying an .ini file
Phillip J. Eby
pje at telecommunity.com
Fri Jun 18 01:09:41 EDT 2004
At 04:57 PM 6/17/04 -0700, darryl wrote:
>Is this terribly bad form?
Nope; that's (partly) what 'iniFiles' is there for, if you want to create a
custom startup script.
But I find it hard to think of a circumstance where I'd do that,
personally. I suppose on Windows it might be convenient to be able to
double-click on a .py file and launch it, in place of trying to launch an
(However, there's nothing stopping you in that case from using a '.peak'
extension and configuring Windows to run 'python.exe peak runIni' on them!)
Anyway, there are several other methods available to do what you're asking
about, I mention them here so you have a choice and so that other people
aren't led to believe that your suggestion is the only way or even the
preferable way for their circumstance. :)
* Specify one or more .ini files in the PEAK_CONFIG environment variable,
using the platform's path separator (e.g. ':' on Posix-like OSes, ';' on
DOS/Windows) to separate them
* Create an .ini file that loads other .ini files, using:
[Load Settings From]
file = "some.filename"
* Create an .ini file that runs your application, rather than an
application that loads an .ini file. You do this by specifying something like:
[Import on Demand]
my_appmodule = "some.package.containing.my_appmodule"
app = my_appmodule.MyAppClass
And then you can run it using 'peak runIni myApp.ini'
* Make your .ini file executable, by putting '#!peak runIni' or something
similar at the top of it
* Name .ini files something other than .ini, if you like; it's the 'peak
runIni' that causes them to be interpreted as that format.
* You can manually load an .ini file into *any* configurable component,
Hmm, is that everything? Anyway, there are a great many ways to do it,
although which one is the One Obvious Way To Do It may vary according to
your circumstances. :)
For me, the One Obvious Way is executable .ini files in Posix runtime
environments. For Windows, just make program shortcut icons that run the
equivalent of 'peak runIni' on your root configuration file. This is the
method requiring the least boilerplate to activate an application, because
you need only add the 'peak.running.app' definition to the .ini file, and
don't have to write any extra setup code in a script.
More information about the PEAK