Bug #14406
Part of the migration scripts are broken after moving them into directories
Description
With the move of migration scripts into ${LARSOFT_DIR}/bin
subdirectories on LArSoft 6.11 (larsoft:d2e0b4494d7b939216494a3485ce622d0da359cb):
- moved scripts are not available via
PATH
: users have to find the scripts and specify the full path - python scripts which use
SerialSubstitution.py
library fail to find it
The first point may be "solved" by updating the documentation, as it is not reasonable to pollute PATH
list with the subdirectories.
The second point needs to be investigated. Either a programmatic solution is found, or a copy or symbolic link of the library must be stored with each python script.
History
#1 Updated by Lynn Garren over 4 years ago
Are all scripts still needed?
#2 Updated by Lynn Garren over 4 years ago
- Status changed from New to Assigned
- Assignee set to Lynn Garren
Append LARSOFT_DIR/bin to PYTHONPATH. Gianluca will verify that this is sufficient.
The instructions will be modified.
#3 Updated by Gianluca Petrillo over 4 years ago
Adding ${LARSOFT_DIR}/bin
to PYTHONPATH
solves the issue.
Programmatic lookup is also possible:
import sys, os
try:
LArSoftLibPath = os.path.join(os.environ['LARSOFT_DIR'], 'bin')
if (os.path.isdir(LArSoftLibPath)): sys.path.insert(1, LArSoftLibPath)
except KeyError: pass
but it is an inferior solution in terms of maintainability, requiring to change the scripts at every reorganisation (which we love to do often).
My recommendation is to create a ${LARSOFT_DIR}/python
directory where to put python libraries, and add that to PYTHONPATH
.
The ${LARSOFT_DIR}/bin
directory (and subdirectories) would contain only the end-user scripts.
#4 Updated by Lynn Garren over 4 years ago
This is a workable solution.
#5 Updated by Lynn Garren over 4 years ago
- % Done changed from 0 to 80
- Estimated time set to 2.00 h
Changes are in larsoft develop ready for the next release. The python directory is $LARSOFT_DIR/bin/python
#6 Updated by Lynn Garren over 4 years ago
- Status changed from Assigned to Resolved
- % Done changed from 80 to 100
This change was implemented in larsoft v06_17_00.
#7 Updated by Lynn Garren over 4 years ago
- Status changed from Resolved to Closed