本文整理汇总了Python中smodels.tools.smodelsLogging.logger.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, path=None):
self.path = path
if path:
logger.debug('Creating object based on %s' %self.path)
#Open the info file and get the information:
if not os.path.isfile(path):
logger.error("Info file %s not found" % path)
raise SModelSError()
from smodels.tools.stringTools import concatenateLines
infoFile = open(self.path)
content = concatenateLines ( infoFile.readlines() )
infoFile.close()
#Get tags in info file:
tags = [line.split(':', 1)[0].strip() for line in content]
for i,tag in enumerate(tags):
if not tag: continue
line = content[i]
value = line.split(':',1)[1].strip()
if tags.count(tag) == 1:
self.addInfo(tag,value)
else:
logger.info("Ignoring unknown field %s found in file %s"
% (tag, self.path))
continue
开发者ID:SModelS,项目名称:smodels,代码行数:27,代码来源:infoObj.py
示例2: flush
def flush(self):
"""
Write the python dictionaries generated by the object formatting
to the defined output
"""
outputDict = {}
for obj in self.toPrint:
if obj is None: continue
output = self._formatObj(obj)
if not output: continue #Skip empty output
outputDict.update(output)
output = 'smodelsOutput = '+str(outputDict)
if self.output == 'stdout':
sys.stdout.write(output)
elif self.output == 'file':
if not self.filename:
logger.error('Filename not defined for printer')
return False
with open(self.filename, "a") as outfile:
outfile.write(output)
outfile.close()
self.toPrint = [None]*len(self.printingOrder)
## it is a special feature of the python printer
## that we also return the output dictionary
return outputDict
开发者ID:SModelS,项目名称:smodels,代码行数:28,代码来源:printer.py
示例3: createExpResult
def createExpResult ( self, root ):
""" create, from pickle file or text files """
txtmeta = Meta ( root, discard_zeroes = self.txt_meta.discard_zeroes,
hasFastLim=None, databaseVersion = self.databaseVersion )
pclfile = "%s/.%s" % ( root, txtmeta.getPickleFileName() )
logger.debug ( "Creating %s, pcl=%s" % (root,pclfile ) )
expres = None
try:
# logger.info ( "%s exists? %d" % ( pclfile,os.path.exists ( pclfile ) ) )
if not self.force_load=="txt" and os.path.exists ( pclfile ):
# logger.info ( "%s exists" % ( pclfile ) )
with open(pclfile,"rb" ) as f:
logger.debug ( "Loading: %s" % pclfile )
## read meta from pickle
pclmeta = serializer.load ( f )
if not pclmeta.needsUpdate ( txtmeta ):
logger.debug ( "we can use expres from pickle file %s" % pclfile )
expres = serializer.load ( f )
else:
logger.debug ( "we cannot use expres from pickle file %s" % pclfile )
logger.debug ( "txt meta %s" % txtmeta )
logger.debug ( "pcl meta %s" % pclmeta )
logger.debug ( "pcl meta needs update %s" % pclmeta.needsUpdate ( txtmeta ) )
except IOError as e:
logger.error ( "exception %s" % e )
if not expres: ## create from text file
expres = ExpResult(root, discard_zeroes = self.txt_meta.discard_zeroes )
if self.subpickle and expres: expres.writePickle( self.databaseVersion )
if expres:
contact = expres.globalInfo.getInfo("contact")
if contact and "fastlim" in contact.lower():
self.txt_meta.hasFastLim = True
return expres
开发者ID:SModelS,项目名称:smodels,代码行数:33,代码来源:databaseObj.py
注:本文中的smodels.tools.smodelsLogging.logger.error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论