CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/Utilities/ReleaseScripts/python/cmsCodeRules/pickleFileCreater.py

Go to the documentation of this file.
00001 __author__="Aurelija"
00002 __date__ ="$2010-07-26 12.51.12$"
00003 
00004 from os.path import join
00005 import pickle
00006 import os
00007 
00008 def createPickleFile(fileName, listRule, path = os.getcwd()):
00009 
00010     dict = {}
00011     
00012     try:
00013         for filePath, lines in listRule:
00014            dict[filePath] = lines
00015         file = open(join(path, fileName), 'w')
00016         pickle.dump(dict, file)
00017         file.close()
00018     except TypeError:
00019         print 'Wrong types'
00020     except IOError:
00021         print 'Cannot open %s file'%fileName