Right, the way I understand this, we should be able to put the following
code into python/ccpnmr/analysis/AnalysisGui.py (just under the "if
(__name == '__main__')" line):
startupFile = os.environ.get('PYTHONSTARTUP')
if startupFile:
execfile(startupFile)
and hopefully that will do what you want. Can anybody see anything wrong
with this? I guess it would be useful if Chris could try this out! One
thing I can see wrong is that philosophically Mr Python evidently decided
that PYTHONSTARTUP should be ignored in the case at hand, or perhaps it
was an oversight?? So would the above behaviour do "bad" things for some
people, because they have PYTHONSTARTUP set, but do not expect it to be
executed in this kind of case? We could instead do something like
startupFile = os.environ.get('ANALYSIS_STARTUP')
...
(I prefer the "_"), i.e. introduce a new optional environment variable,
and you could just set it to PYTHONSTARTUP if you want it to be the same.
Wayne
On Tue, 4 Apr 2006, Chris MacRaild wrote:
> It would be nice to have a startup file for Analysis to allow
> project-independent preferences to be defined and other features to be
> setup.
>
> This came up because I noticed that the analysis python command line
> lacks the niceties I've set up for other interactive python sessions.
> This is because when called with -i python doesn't read the
> PYTHONSTARTUP file.
>
> All I have in mind is a python file that will be executed on startup if
> it exists.
>
> Thanks,
>
> Chris
>
|