ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PsetManipulator.py
(Generate patch)

Comparing COMP/CRAB/python/PsetManipulator.py (file contents):
Revision 1.14 by ewv, Fri Dec 7 21:41:20 2007 UTC vs.
Revision 1.15 by slacapra, Fri Jan 4 17:30:56 2008 UTC

# Line 2 | Line 2
2  
3   import os
4   import common
5 import imp
5   from crab_util import *
6   from crab_exceptions import *
7   from crab_logger import Logger
# Line 26 | Line 25 | class PsetManipulator:
25          from FWCore.ParameterSet.Config import include
26          common.logger.debug(3,"PsetManipulator::__init__: PSet file = "+self.pset)
27          if (self.pset.endswith('py') or self.pset.endswith('pycfg') ):
28 <          handle = open(self.pset, 'r')
29 <          try:   # Nested form for Python < 2.5
28 >            handle = open(self.pset, 'r')
29 >            try:   # Nested form for Python < 2.5
30 >                try:
31 >                    self.cfo = imp.load_source("pycfg", self.pset, handle)
32 >                except Exception, ex:
33 >                    msg = "Your pycfg file is not valid python: %s" % str(ex)
34 >                    raise CrabException(msg)
35 >            finally:
36 >                handle.close()
37 >            self.cfg = CfgInterface(self.cfo.process)
38 >        else:
39              try:
40 <              self.cfo = imp.load_source("pycfg", self.pset, handle)
40 >                self.cfo = include(self.pset)
41 >                self.cfg = CfgInterface(self.cfo)
42              except Exception, ex:
43 <              msg = "Your pycfg file is not valid python: %s" % str(ex)
44 <              raise CrabException(msg)
45 <          finally:
46 <              handle.close()
47 <          self.cfg = CfgInterface(self.cfo.process)
48 <        else:
40 <          try:
41 <            self.cfo = include(self.pset)
42 <            self.cfg = CfgInterface(self.cfo)
43 <          except Exception, ex:
44 <            msg =  "Your cfg file is not valid, %s\n" % str(ex)
45 <            msg += "  https://twiki.cern.ch/twiki/bin/view/CMS/CrabFaq#Problem_with_ParameterSet_parsin\n"
46 <            msg += "  may help you understand the problem."
47 <            raise CrabException(msg)
43 >                msg =  "Your cfg file is not valid, %s\n" % str(ex)
44 >                msg += "  https://twiki.cern.ch/twiki/bin/view/CMS/CrabFaq#Problem_with_ParameterSet_parsin\n"
45 >                msg += "  may help you understand the problem."
46 >                raise CrabException(msg)
47 >        pass
48 >
49      def inputModule(self, source):
50          """
51          Set  vString Filenames key
# Line 158 | Line 159 | class PsetManipulator:
159          if name not in messageLogger.fwkJobReports:
160              messageLogger.fwkJobReports.append(name)
161  
162 <        return
162 >        return

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines