A message from Jean Ballet:

From jean.ballet@cea.fr Tue Jun 17 01:09:12 2008
Subject: python code in binary release Science Tools
Date: Tue, 17 Jun 2008 10:07:16 +0200
To: <jchiang@slac.stanford.edu>
Cc: <tburnett@u.washington.edu>, <ngolpa@gmail.com>

Dear Jim,

 

After Ludovic reported that he had trouble using the new pointfit python
module I remembered that I had failed to use ModelEditor at some point.

So I tried again, using the binary release of ST v9r5p4.

 

ModelEditor

Traceback (most recent call last):

  File "<string>", line 1, in ?

  File
"/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/pythonModules/Mode
lEditor.py", line 15, in ?

    import Tkinter as Tk

ImportError: No module named Tkinter

 

I tried to understand why this occurred. I looked into
${INST_DIR}/bin/config/setup.sh and noticed that

PYTHONPATH="${INST_DIR}/pythonModules:${INST_DIR}/python/lib/python2.4:$
{PYLIKELIHOODROOT}/python:${INST_DIR}/lib:${ROOTSYS}/lib:${PYTHONPATH}";
export PYTHONPATH

although there was no such directory as
${INST_DIR}/python/lib/python2.4. python2.5 was present there instead.

I tried changing python2.4 to python2.5

 

ModelEditor                                           'import site'
failed; use -v for traceback

Traceback (most recent call last):

  File "<string>", line 1, in ?

  File
"/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/pythonModules/Mode
lEditor.py", line 11, in ?

    import os

  File
"/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/python/lib/python2
.5/os.py", line 134

    from os.path import (curdir, pardir, sep, pathsep, defpath, extsep,
altsep,

                        ^

SyntaxError: invalid syntax

 

It looks like os.py under python2.5 is not compatible with the python
version that is called by ModelEditor.

If I try calling ModelEditor.py directly I get

 

gtpython
/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/pythonModules/Model
Editor.py

Traceback (most recent call last):

  File
"/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/pythonModules/Mode
lEditor.py", line 538, in <module>

    ModelEditor()

  File
"/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/pythonModules/Mode
lEditor.py", line 531, in ModelEditor

    root = RootWindow(_spectralFuncs, _spatialFuncs)

  File
"/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/pythonModules/Mode
lEditor.py", line 31, in __init__

    Tk.Tk.__init__(self)

  File
"/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/python/lib/python2
.5/lib-tk/Tkinter.py", line 1636, in __init__

    self.tk = _tkinter.create(screenName, baseName, className,
interactive, wantobjects, useTk, sync, use)

_tkinter.TclError: Can't find a usable init.tcl in the following
directories:

 
/software/lheasoft/irby/sas/heasoft61/headas/headas-6.1/tcltk/i686-pc-li
nux-gnu-libc2.2.4/lib/tcl8.4
/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/python/lib/tcl8.4
/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/lib/tcl8.4
/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/python/library
/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/library
/dsm/saplxglast/glast/sas/binary/ScienceTools-v9r5p4/tcl8.4.13/library
/dsm/saplxglast/glast/sas/binary/tcl8.4.13/library
/software/lheasoft/irby/sas/heasoft61/headas/headas-6.1/tcltk/i686-pc-li
nux-gnu-libc2.2.4/lib/tcl8.4

 

This probably means that Tcl wasn't installed properly.

 

Here it went further. I looked around but could find no trace of a TCL
library under the binary ST distribution.

The references to lheasoft (FTOOLS) look hardcoded from the place where
the Science Tools were compiled.

My impression is that the python implementation in the binary release of
the Science Tools is quite shaky.

It works for pyLikelihood, but not for much else.

 

The outcome of the 2nd trial (after changing python2.4 to 2.5) suggests
that ModelEditor does NOT call the python version in the Science Tools
(under $INST_DIR/python/bin) but the native python on my system (which
happens to be 2.3.4).

This is very possible if it does not use gtpython, because
$INST_DIR/python/bin is not in PATH (it has no reason to be).

If I add $INST_DIR/python/bin to my PATH, then ModelEditor returns the
same error message as the call to ModelEditor.py via gtpython.

 

All the best,

Jean