> I'm working on a Python script that relies on the output from certain
> KAPPA commands (eg. STATS, FITSLIST) for part of its functionality. I
> prefer doing it this way versus in a tcsh script because of the relative
> ease of use of Python. The trouble is, when I attempt to run my Python
> code from within a tcsh environment primed with KAPPA, it doesn't seem
> to have access to the KAPPA command from the calling parent shell's
> environment. Is there a way to enable this? Or do I have to invoke
> KAPPA within the Python environment?
Hello,
The problem with that is that commands like "stats" are just set up as
(t)csh aliases by typing "kappa". To run them from outside of (t)csh
you'll need to give the pathname, which you could construct in a manner
such as:
os.path.join(os.environ['KAPPA_DIR'], 'stats')
You might also like to check out David's "starutil.py" module in
applications/smurf/scripts, especially the "invoke" function, as that
looks like it's intended to help you run Starlink applications from
Python. There's an example of running "stats" in the documentation there.
Best regards,
Graham
|