diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/generatePRW.py b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/generatePRW.py index 20790efb7347d854070ddf956d5cfc00ef1bb6cf..e417d9815caf287953953238a5199cfa19415ea6 100755 --- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/generatePRW.py +++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/scripts/generatePRW.py @@ -107,7 +107,10 @@ def main(): ntupDatasetName = ntupDatasetName.replace("merge","%") #remove everything after first rtag of ami tag .. replace with wildcard first_rtag_pos = ntupDatasetName.index("_r",ntupDatasetName.index("NTUP_PILEUP")) - next_underscore_pos = ntupDatasetName.index("_",first_rtag_pos+1) + try: + next_underscore_pos = ntupDatasetName.index("_",first_rtag_pos+1) + except ValueError: + next_underscore_pos = len(ntupDatasetName) ntupDatasetName = ntupDatasetName[:next_underscore_pos]+"%" res = atlasAPI.list_datasets(client, ntupDatasetName,fields='ldn,prodsys_status') foundNTUP=False